Author Topic: Is it ok to create a virtual ground for MCU  (Read 7304 times)

0 Members and 1 Guest are viewing this topic.

Offline ConnoiseurTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Is it ok to create a virtual ground for MCU
« on: August 12, 2016, 02:39:17 pm »
Hi,

I am designing a circuit which extensively uses Op-amps to do functions like precision rectification, filtering, summing etc. The entire circuit is supposed to be powered from a single 24V power supply. Since these functions can only be satisfactorily carried out with a dual supply, I'm splitting the rail to +12_0_-12V using a uA741 with 2n3904 on the output to get more current.

So far so good, however, the output from the analog circuit needs to be fed to the adc pin of microcontroller (mega 32U4).
Is it desirable to power the mcu with a similar split supply or I've to change the entire design such that all the component's ground is THE GROUND and not some high impedance node hanging in the air? :-//

How is a mixed signal circuit designed in real life? (I mean with relation to power supply rails)

Thanks :)
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: Is it ok to create a virtual ground for MCU
« Reply #1 on: August 12, 2016, 02:55:36 pm »
It depends:
- Are there any external connections that expose the split rail 'ground'?
- Are you certain that neither the 24V supply nor any device it powers are ground referenced?
- Can the rail splitter sink enough current to reliably power the MCU if its fed from a simple linear 5V regulator from the +ve rail?

If the answer to any of those questions is NO, you are probably going to need a switching supply that provides both a -ve rail for the analog circuits and 5V for the MCU.
 
The following users thanked this post: Connoiseur

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Is it ok to create a virtual ground for MCU
« Reply #2 on: August 12, 2016, 03:29:02 pm »
Just before you stuff the analog signals into the uC ADC, you do a bit of level shifting and offset such that all the signals are within the range of the ADC.  That way you can have a solid ground on your analog supplies and a solid ground for the digital side.  They should probably be kept separate until they are joined at one specific location but there's probably a lot of info re: analog/digital grounds on Google.

See chapter 4 of Op Amps For Everyone to see how they implement the offset and scaling with 4 resistors and a single supply op amp.
http://www.siongboon.com/projects/2008-04-27_analog_electronics/op%20amps%20for%20everyone%20third%20edition%202009%20(Texas%20Instrument).pdf

The nice thing about having an op amp just ahead of the ADC is that it can provide the low source impedance that the ADC expects.
 
The following users thanked this post: Connoiseur

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Is it ok to create a virtual ground for MCU
« Reply #3 on: August 12, 2016, 03:36:22 pm »
Either offset and scale into ADC as suggested prior, or develop a - supply
to run OpAmps.

For that latter some approaches, attached.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 
The following users thanked this post: Connoiseur, PartialDischarge

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Is it ok to create a virtual ground for MCU
« Reply #4 on: August 16, 2016, 08:46:06 am »
Hi,(..) the output from the analog circuit needs to be fed to the adc pin of microcontroller (mega 32U4).

I do not want to be picky but op-amp always exposes two pins (reference + signal) and ADC always exposes two pins (reference + signal). So you have to tie both together respectively (mind impedance).

The absolute voltage does not matter. Could be near +24V or could be near 0V or bounce up and down (mind common mode ripple rejection). What is important is that both (op-amp and uC) have limited input voltages range (w.r.t. their own Vcc and GND). But op-amp does not care about GND of uC and uC does not care about GND of Op-amp.

I would not play with making some virtual GND in between 24V and 0V just for the fun of splitting rails. It could be important if you want to drive some bipolar output (P-MOS + N-MOS pair, DC motor, etc) but otherwise I do not see the point.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3238
  • Country: gb
Re: Is it ok to create a virtual ground for MCU
« Reply #5 on: August 16, 2016, 11:18:40 am »
Hi,(..) the output from the analog circuit needs to be fed to the adc pin of microcontroller (mega 32U4).

I do not want to be picky but op-amp always exposes two pins (reference + signal) and ADC always exposes two pins (reference + signal). So you have to tie both together respectively (mind impedance).

ADCs do not always expose a separate reference pin.
 
The following users thanked this post: Connoiseur

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Is it ok to create a virtual ground for MCU
« Reply #6 on: August 16, 2016, 11:34:44 am »
ADCs do not always expose a separate reference pin.
Then the reference must be wired internally to something  ^-^
Usually to AGND. Now you say that not all ADCs have separate AGND. Well then this must be wired to GND that is shared with digital part. With dedicated pin or not - it is somewhere there, just keep looking.
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Is it ok to create a virtual ground for MCU
« Reply #7 on: August 16, 2016, 01:18:54 pm »
The Reference pin is NOT tied to AGND nor should it be. This is the + reference voltage for the ADC inside the 32U4.

If you run the 32U4 from +3.3v and GND - the GND being common to all circuits including the op-amps, the output of the op-amp and therefore the input of the ADC must never go below GND and never above what the internal reference voltage for the 32U4 is and definately not above the 32U4's +3.3v rail, please read the 32U4 absolute maximum ratings to determine the actual values.
Yo can do this by setting up an offset on the op-amp or by using a resistor divider  between the op-amp and ADC, the latter offers a higher degree of protection against damage/misuse.
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 614
Re: Is it ok to create a virtual ground for MCU
« Reply #8 on: August 16, 2016, 01:48:35 pm »
The Reference pin is NOT tied to AGND nor should it be. This is the + reference voltage for the ADC inside the 32U4.
You are right, that is not precise enough, by "reference" I meant "the reference of the input signal".

Sorry for the confusion, "reference of input signal" and "ADC voltage reference == AREF pin on ATMegas" are two completely different animals. Anyway, the op-amp arrangement reference must be tied to the former.
 

Offline bobaruni

  • Regular Contributor
  • *
  • Posts: 156
  • Country: au
Re: Is it ok to create a virtual ground for MCU
« Reply #9 on: August 16, 2016, 02:50:44 pm »
Quote
How is a mixed signal circuit designed in real life? (I mean with relation to power supply rails)

Generally, best practice is sometimes very low impedance common GND when mixing digital and analog but sometimes it can be separated by a few ohms to reduce digital noise and reduce eddy currents, especially in audio.
It's whatever you can think of and works well for your application.
 
The following users thanked this post: Connoiseur

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21661
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Is it ok to create a virtual ground for MCU
« Reply #10 on: August 16, 2016, 02:56:34 pm »
The MCU doesn't care, as long as its supply is nominal.

You might care, though.  That puts digital currents into the analog rail.  Which is still okay as long as all digital signals are referenced to the same ground (as they must be), but, any current leaving that domain (level shifters to +/-12V?) will be kind of a problem.

Better to think of it this way: GND is GND, and the "virtual ground" op-amp is pulling the "+12" down, or the "-12" up, so as to keep the 12's balanced around GND.

Don't forget to use GND planes or pour (stitched), if this gets to a PCB.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: Is it ok to create a virtual ground for MCU
« Reply #11 on: August 17, 2016, 12:16:43 am »
I'm splitting the rail to +12_0_-12V using a uA741 with 2n3904 on the output to get more current.

Think of what you have here. The uA741 output can source or sink current. When you add one transistor to output you have changed bidirectional correction of uA741to unidirectional correction.

A 2n3904 would act like a LM7812. while a 2N3906 would act like a LM7912

LM7812 a positive regulator can cause a positive change of voltage across the load.
The load is what makes a negative change of voltage.

LM7912 a negative regulator can cause a negative  change of voltage across the load.
The load is what makes a positive change of voltage.

With the 2N3904 you are increasing the load on 0 to +12 to correct for a load change on the -12 to 0. The -12 to 0 needs to be the largest load.
If this is not true you could have +4, 0, -20 and the 2N3904 not be able to correct it.
 

Offline ConnoiseurTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: Is it ok to create a virtual ground for MCU
« Reply #12 on: August 18, 2016, 06:51:02 am »
Thanks everyone for your valuable inputs.

After going through all of your suggestions, I've revised my supply design as shown in the attachment.



I'm building a pump controller for a small dyeing unit which was run manually. The MCU checks the levels of liquids in two tanks and some other parameters to turns ON the pumps based on some conditions. Since the initial signal conditioning is to be done by op-amps (including reading current from 100/5A CT), hence the dual supply. The time of turning ON and duration etc are to be logged on the SD card. The motors are to be turned ON/OFF by contactors whose coil is 24V operated. :phew:

(I'll be using optos before the MOS that energises contactor coil) :)
« Last Edit: August 18, 2016, 06:52:49 am by Connoiseur »
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21661
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Is it ok to create a virtual ground for MCU
« Reply #13 on: August 18, 2016, 11:42:39 am »
Beware that the 555 will make quite a lot of power supply noise, on both sides.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Is it ok to create a virtual ground for MCU
« Reply #14 on: August 19, 2016, 08:27:06 am »
Please post the schematic of the circuit you need to power. Perhaps you may be able to modify it so it will work from a single supply?

It's possible to make a precision rectifier which will work off a single supply.  The datasheet for the CA3140 has an example on page 18 of the data sheet. The circuit will work with other op-amps.
http://www.intersil.com/content/dam/Intersil/documents/ca31/ca3140-a.pdf

To make a split rail supply with an op-amp, two output transistors are required: one NPN and the other PNP.
 

Offline ConnoiseurTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: Is it ok to create a virtual ground for MCU
« Reply #15 on: August 20, 2016, 07:36:17 am »
Please post the schematic of the circuit you need to power. Perhaps you may be able to modify it so it will work from a single supply?

It's possible to make a precision rectifier which will work off a single supply.  The datasheet for the CA3140 has an example on page 18 of the data sheet. The circuit will work with other op-amps.
http://www.intersil.com/content/dam/Intersil/documents/ca31/ca3140-a.pdf

To make a split rail supply with an op-amp, two output transistors are required: one NPN and the other PNP.


Sure. I'll do it in a few hours, have to clean up a bit and name the nets properly for easy understanding. Thanks very much :)
 

Offline ConnoiseurTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: Is it ok to create a virtual ground for MCU
« Reply #16 on: August 20, 2016, 10:23:24 am »
Please post the schematic of the circuit you need to power. Perhaps you may be able to modify it so it will work from a single supply?



Here is the schematic. It's not complete as I'm wrestling to get the right footprint for the jacks and some other components. Anyway if I don't find them I might make it AutoCad and export the dxf or get from eagle by running ulp.

I hope the schematic is understandable, if not any suggestions are welcome, being a inexperienced freshman I'm not very familiar with the actual stuff.

NB: Don't worry, if it looks horrible, it will go for a review by my senior before implementation, so I'm not in a danger of screwing things up and blowing up anything expensive or important. It's has been assigned to basically test me (probation).
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Is it ok to create a virtual ground for MCU
« Reply #17 on: August 21, 2016, 12:23:59 am »
I don't see how the level shifter is supposed to work. You do know you can use the 74HCT244 to shift 3V logic signals up to 5V? That would eliminate all those resistors and transistors.
http://www.nxp.com/documents/data_sheet/74HC_HCT244.pdf

I'm sure you don't need all of those op-amps. For example, for the temperature sensor, can't you just us a 150R resistor, which will give 0.6V to 3V and feed it straight into the ADC?

The circuit I posted previously posted a link to can be used to rectify the output of those current transformers and only needs one voltage rail. Failing that, can't you bias one side of the current transformers to a potential divider on the 3.3V rail to bias it at half the supply and directly feed the ADCs? The burden resistor may have to be changed to give a maximum of 3.3V peak to peak but it should work.

EDIT:
Here's another precision full wave rectifier circuit, which will work of a single supply rail.n If you don't have the LT1078, it will work with the LM358 or LM324 but the offset will be higher, although you can null it using software.
http://www.linear.com/solutions/1608
« Last Edit: August 21, 2016, 12:39:15 am by Hero999 »
 

Offline ConnoiseurTopic starter

  • Regular Contributor
  • *
  • Posts: 104
  • Country: in
Re: Is it ok to create a virtual ground for MCU
« Reply #18 on: August 21, 2016, 03:53:00 am »
I don't see how the level shifter is supposed to work. You do know you can use the 74HCT244 to shift 3V logic signals up to 5V? That would eliminate all those resistors and transistors.

The level shifter does work (atleast in simulation!) :-//

I had totally forgotten about that chip. I usually use cheap ones off eBay that have a circuit like I've made.

And thank you so much for your suggestions. It greatly simplified my design and improved reliability + performance.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Is it ok to create a virtual ground for MCU
« Reply #19 on: August 21, 2016, 10:57:31 am »
I don't see how the level shifter is supposed to work. You do know you can use the 74HCT244 to shift 3V logic signals up to 5V? That would eliminate all those resistors and transistors.

The level shifter does work (atleast in simulation!) :-//

I had totally forgotten about that chip. I usually use cheap ones off eBay that have a circuit like I've made.

And thank you so much for your suggestions. It greatly simplified my design and improved reliability + performance.
Oh I see, now you've posted the complete circuit for the level shifter, I understand. The usual way is to use a MOSFET, normally the 2N7002 but it works with a BJT too and has the advantage of being bidirectional. The 74HCT244 is faster and doesn't take up so much space on the PCB but it's only unidirectional.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: Is it ok to create a virtual ground for MCU
« Reply #20 on: August 21, 2016, 12:22:34 pm »
Use a bidirectional level translator, e.g the 74LVC2T45 which is a dual level translating buffer with a direction input and two separate Vcc pins, each rated for operation 1.8V - 5.5V.

You'd use two for the 4 bit data base with their DIR pin fed from an inverter fed fron the MCU side LCD RW signal.   Two more handle RS RW and E with their DIR pin tied high to make them unidirectional.    Its not recommended to let their inputs float, so pullups either side of the data bus ones should be used. 

During development, 220R resistors in series with the data bus between the MCU  and the level shifters are advisable, in case you b-----r up the direction changing code and cause bus contention.
 
The following users thanked this post: Connoiseur

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19494
  • Country: gb
  • 0999
Re: Is it ok to create a virtual ground for MCU
« Reply #21 on: August 21, 2016, 09:04:57 pm »
The advantage of the discrete logic level shifter, is there's no need to manually change the direction. It does that automatically.

The 74HCT224 can also be made to be bidirectional but it isn't automatic and requires some resistors.

 
The following users thanked this post: Connoiseur

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: Is it ok to create a virtual ground for MCU
« Reply #22 on: August 21, 2016, 09:36:45 pm »
Yes, but if you are using a 74HCT245 for a LED in 4 bit mode, you absolutely do NOT want to tristate RS, RW and E which means you cant use the '245 for them as it only has one /OE for all 8 data lines.

If you use a 74HCT241 you can tristate each nibble independently,
Use the nibble with the /OE pin for the data bus with /OE driven from  RW, wit resistors across it as per your diagram.  Use the other nibble for the control lines with its OE pin tied high to permanently enable them.
 
The following users thanked this post: Connoiseur


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf