Arduino R4 OPAMP - Differential Mode Configuration

Hello, I am new to programming, but I have a strong desire to learn. I am trying to use the built-in operational amplifier in differential mode. Unfortunately, I can't find much information online. I found the configuration registers for it, but I'm not sure how to activate it in differential mode and how to monitor the output signal of the operational amplifier in my main loop.

#define MSTPD31 31 // OPAMP - Operational Amplifier Module.

I would like to use direct register access for speed purposes.

It is just one bit in Module Stop Control Register D (MSTPCRD).

There are some ways to handle opamp on UNO R4.

  1. OPAMP library
    ArduinoCore-renesas/libraries/OPAMP at main · arduino/ArduinoCore-renesas · GitHub

  2. RA FSP
    RA Flexible Software Package Documentation: Operational Amplifier (r_opamp)
    (Note: OPAMP library uses this package.)

  3. Registers
    You can find the RA4M1 document "Renesas RA4M1 Group User’s Manual: Hardware"

In that document, you can refer to the page 1166 "38. Operational Amplifier (OPAMP)". Also you can access the registers using R_OPAMP_Type:

and its start address is defined as R_OPAMP:

Thank you very much for your answer, I will look in detail at the options you gave me. I would like to use "3.Registers for RA4M1" because with these registers I read directly from an ADC and write directly to the DAC. I used some examples for this, but I could not find one for activating the operational amplifier in differential.

From what I've seen (*thanks to EmbeddedKiddie for the link) it looks like a pretty simple op amp, presumably with a MOSFET input (which doesn't require resistors to DC couple the bases, as you would with abipolar amp) but it also means that it's probably quite noisy.

Op Amps are differential amplifiers by definition: the name originates from mathematical operations as that's what they were originally intended for - as ultra-fast (almost instant) calculators for simple operations and complex calculus.

Analogue computers are making something of a comeback as they draw less power (typically) than a digital box and are often a lot faster since many operations happen at the speed of electrons moving around the semiconductors (about 2/3 C is a good approximation). They don't have to wait for umpteen nanoseconds for bus operations to complete all the way through the propagation delays through the gates. And while many won't have heard of them (or think they are part of a quaint piece of history... they're anything but as this one demonstrates: Try This Brand New Analog Computer - IEEE Spectrum

It's a case of horses for courses. Digital computers can do some things exceptionally well and will leave analogue machines picking sand from their teeth but things in the analogue domain can sometimes be modelled far more accurately using discrete electronics. That's why most computers are digital requiring ADCs ans DACs to read and write to and from the outside world.

There are a couple of rules (that are close, but not perfect): the inputs draw no current and the output tries to do whatever it can (inside a closed loop) to keep the difference between the two input pins = 0.

Modern op amps are very versatile but they come with a huge range of gotchas some of which can catch the unwary in a pinch that seems insoluble. Without some fairly detailed specifications, it's impossible to give you much help but if you to use the op amp in "differential" mode, you can wire it as a simple INA (instrumentation amp). Which requires just four well-matched (1% minimum or better) resistors.

I've just ordered a Minima for an electronic project I'm working on over at DIY Perks' website (it's mixed mode stuff for hobbyist electronic nerds) and part of a series I'm working on, so if you want to find me specifically you're better off over there. (I've done a lot of work on Arduino but my speciality is writing about electronics and tech so I'm more use there). I only chance on the thread looking for that wretched spec. sheet so I know better what I'm dealing with.

Alternatively, there are some excellent texts online by actual experts like James Fiore from Mohawk College but this is more general.

Op Amps (and this is likely no exception) fall apart very quickly trying to drive capacitive loads of more than a few picofarads - misbehaving terribly! Also most op amps are designed to be run from a "split" supply. But that's mostly about making it easier to bias them internally and externally since they are 100% DC coupled.

If your application is amplifying AC, you're going to need DC biasing to keep the inputs in their operational range (or risk destroying the input transistors). Also, op amps have an internal low-pass filter (set around a few Hz typically) that corrects the "zero" created by the internal phase shifts and will only provide consistent amplification within limits determined by things like the gain bandwidth (GBW) which might often be quite modest even at low gains. 1.7Mhz is quite modest but enough for audio (in high-speed mode) up to a gain around 100 (which is more than enough for, say, a simple electret microphone).

The digital finagling to change operational modes is convenient but (if I'm honest) I think many applications would be better served with a low-power jellybean like a TL072 - which is a JFET input, so easy to use and the modern versions from Texas Instruments, are quite performant - considering the cost.

A TL072 has two amplifiers in an 8-pin DIL package, can run single or supply and goes lower than 5V total supply so it runs from USB power. Presumably (I HOPE!) the on-board amp is shielded from the digital ground because otherwise something called "ground bounce" will send the output do-lally-tap faster than you say "#;!".

It's neat that Renesas incorporated one (four actually but I think the inputs are multiplexed) on the die, but I wouldn't like to risk breaking it by experimenting - potentially destroying some of the rest of the MCU - when it's far safer (and a lot less risky) to use one that you can plug into a breadboard and run from a couple of 9V battery packs. And given the low cost of a TL072 (a few cents even from board houses in China in small numbers) It's a bit of a shame Arduino didn't use put (another) on the board where it can be used and tested before risking one of those inputs.

Also the input pins are multiplexed (shared) with the ADC so there are a lot of compromises, as with any engineering, particularly mixed signal designs.

I'll know more myself when I've had time to sit down with one and put it through it's paces, but on paper alone it's a huge leap forward from the older ATMega chips, so who am I to complain?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.