[AmpeROSE] How to discover the AmpeROSE device?

Hi everybody,

As you can expect, here we are going to see how the AmpeROSE could be discovered by the software on the computer. We thought of 2 ways to do that. The first way consists in using the Zeroconf technologies and the second one is our solution using an UDP server on the AmpeROSE.

  1. Zeroconf : The Zeroconf (or Zero-configuration networking) is a providing 3 technologies: the IP address assignations (1), the name resolution (2) and the services discovery (3). The first two technologies are usually done, respectively, by a DHCP server and a DNS server but the Zeroconf does it without any servers. In our application, we would not be using the address assignation since we suppose that a DHCP server will be available but we would use the two other services. In fact, we need only to implement the second part because the service discovery is done by the computer. To implement the name resolution, there are 2 protocols: the multicast DNS (mDNS) and the Link-local Multicast Name Resolution (LLMNR) respectively developed by Apple and Microsoft. If we choose to do it, we will use the mDNS since it is the most used.
  2. UDP server : If we take this option, we will implement a simple udp server on the AmpeROSE responding to a specific broadcast by a message giving its name.

We did not decide which one will be used but here are some of the pros and cons of these solutions:

Pros Cons
Zeroconf Compatible with a widely used protocol. Only partial implementation available.
UDP server Simple implementation. Not standard.


We need to discuss this a little more but if you have suggestions about that feel free to leave a comment J

[AmpeROSE] Simulation of initial calibration

Hello everyone!

This time, we are going to talk about the simulation, especially, some simulation that helps to see how we will do the initial calibration.

First, the full simulated circuit is the following one:

On the top left, there is the current mirror, then in the centre to the right there is the part of the circuit that allows to do the current-to-voltage conversion and a model of the DUT (device under test composed by a battery of 5V and a resistive charge associated to a decoupling capacitor). At the bottom, there is on the left the amplification and then the filter in the middle.  The last element on the right is the simulation of the signals that allows to control the shunts.

Here are some interesting measurements done on this circuit:

At the bottom there is the current generated by the current mirror in the measurement stage. As you can see, it as the form of a pulse, the on level is 2mA. Just above, there are the command signals of the shunts.

Here, we will focus on two times, each being represented by the vertical dotted lines. The first one correspond to the case where the second shunt is activated, so we have current flowing through the shunt 2 and 3. And the second case correspond to all shunts being used.

On the plot above, the signal represented is the output signal on which some computation where done. The formula is the following one: (VFILTER – Voffset) / (100 * 2m). So the first step is the subtraction, we remove the offsets introduced by the amplifiers. It is not represented here but we can measure it, we just have to measure VFILTER when there is no current flowing into the shunts. Then there is a division by 100 which is the amplification and 2m which is the value of the current at our points of interests here. As you may have guessed, this curve allows us to deduce the real resistances of the shunts including the values of the resistances of the transistors. At the first cursor, we can observe that the resistance is 10.002891 Ω and the second give us the value of 176.87423 mΩ.

Then, we can use these values while measuring that what was done on the first plot. We use the following formula: (VFILTER – Voffset) / (100 * Res). So here again, there is the correction of the offset and then the division by the amplification and the value of the resistance, 10. 002891 Ω at the first cursor and 176.87423 mΩ at the second cursor. And as you can see on the plot, the value deduced back is 2mA in both cases which is the actual current flowing.

As you saw here, we have a good faith in our system, now, it will be harder to do exactly the same thing as here. The main reason is that the measurement will be done through an ADC. The results is that the offset may be less precise for example. There is also the fact that resistors will have errors on theirs values, so we may need to verify the value of the amplification. We also may have an error on the current generated. So even though these results are promising, we will have a lot to do in our software to do a good initial calibration.

[AmpeROSE] Current generation for the initial calibration


As you saw in a previous post, we are going to do some measurements on the AmpeROSE to do an initial calibration, to correct eventual imprecisions. To do that we need to be able to put a current that we know and control precisely. In order to achieve our goal, we decided to use a current mirror, the one we are going to use was built by Analog Devices and has the reference ADL5315. The following figure shows you how we will use it.

Since it is a current mirror there is some current being copied from somewhere to somewhere. Here it is the current flowing through INPT that is copied to IOUT. Then this current is injected in our measurement system : MIR+ and MIR- are connected to the shunts.

To generate a current on INPT, we used a resistor to force the current which depends on the voltage on the INPT pin. So, we also need to control the voltage on this pin. That is simple here because we have the same voltage on INPT and VSET, so we only need to force one voltage on the VSET pin to have the same on INPT. Then we know the voltage and the resistor so we can deduce the current. In our application, we want to have some precise current, so we chose the current and then we compute and apply the voltage  we need of VSET.  As you can see, we have 2 resistors, so depending the current we need to generate, we use one or both (which is almost equivalent as saying the other here).

To control the voltage on VSET, we are using a voltage divider. This voltage divider is built upon a digital potentiometer. So, we can use it to vary  the VSET voltage to generate multiple values of currents.

Here are the equations that allow us to know how to generate a current :

  • VSET= Rpot /(Rpot + 100K)
  • Iout=Iin= VSET/Rinpt

According to these equation these are the values of current we can generate : from 100nA to 500nA and from 500uA to 2.5mA.

[AmpeROSE] The amplification

As you saw in our previous posts, we were going to use the amplifier MAX4239 but after some simulations, we decided to replace it with the ADA4807. We will explain here why we took this decision.

To test the amplifier, we did a simulation using them in the same way they will be used in AmpeROSE: as a differential amplifier with a gain of 100. Here is the schematic of this simulation.

As you can see, we put the same signal as input on the two differential amplifiers, this signal is represented on the following figure.

It is a simple pulse, we put this signal because we think it represents well the activation of a peripheral that consumes a lot after the system was in sleep mode. When we tried such an input on our simulation with the MAX4239, we got a really bad surprise that you can see on the following picture:

The amplifier did not react fast enough because it has a slew rate too low! After that we decided that we have to change it because a common case like this one should be measured well.

So we searched for others operational amplifiers with a better slew rate and we finally choose to use the ADA4807 which was much better as you can see on the output on the figure below.

You know now why we change our amplifier. This choice has unfortunately some drawbacks, notably we will need here a negative supply. This amplifier also has bigger offset but since the software will correct it with the initial calibration, this is not a problem.

[AmpeROSE] Calibration intervals

One of the task done this week is the choice of the calibration intervals that will be used for the automatic calibration of the AmpeROSE. The first thing you need to know is that we are going to use a shunt ammeter, so this work is done to exploit this type of ammeter.

First, we fixed the voltage range that will be measured by the ADC. Since our Voltage reference will be 3 V, the maximum input is 3V.  Then we decided to have a minimum input voltage of 10 mV because it becomes hard to convert a voltage around 1 mV precisely.

With these values and the maximum allowed burden voltage of 50 mV, we can calculate the calibration intervals. First, we deduce the amplification needed from the maximum burden voltage and maximum input of the ADC, we obtain an amplification of 60. Then, we calculate the minimum burden voltage which is 166.67 µV. These values define the intervals which have the following form [Rshunt*50e-3; Rshunt*166.67e-6] (or [x; x*300] where x is the minimum current measured).

With all that we got the following intervals (with an ADC of 24 bits):

Current min (A)


Current max (A)

Resolution (A)

Error max

Error min

Interval 1







Interval 2







Interval 3







Interval 4








But here we have a problem which is that we cannot have a resistor of 166.67 kΩ or 166.67 mΩ. Moreover, we cannot have any value we want but only multiples of the normalized values. The closest normalized value for us is 165 which will allow us to have resistor of 165 kΩ in the first interval for example. With the normalized values we obtain slightly different values which are the following ones:


Current min (A)


Current max (A)

Resolution (A)

Error max

Error min

Interval 1







Interval 2







Interval 3







Interval 4








These values are good for us because we still are able to measure up to 300 mA and 10 nA.

[AmpeROSE] How to measure the current?

After having read some documentation about measurement here and there, we noticed that there are two main methods to do it. The ammeters using the first method are known as the shunt ammeters and the second as feedback ammeters. The measure of a current is done by converting a current to a voltage that we can directly read using an ADC (Analog to Digital Converter). Even though this is in common in the two method, they do it differently. We are going to see how it is done for each and the differences.

  1. Shunt ammeters

Source : « Linear Technology » (figure 1 from the appplication note of Linear Technology about current sensing)

In this method, a resistor is put in the circuit and we measure the voltage over this resistor. Using the Ohm’s law we can recover easily the current that flowed in it. This resistor is called “shunt”. Usually, the voltage is amplified with an operational amplifier before being measured.

We need to amplify the voltage over the shunt because we are trying to have the smallest voltage in order to keep the circuit under test as if it was not. This voltage is a drawback for this method and even has a name which is the “burden voltage”.

Trying to have a small burden voltage leads to minimizing the value of the resistance too but this is not so easy to do. Indeed, the more we reduce its value, the more it becomes sensitive to the thermal noise.

The small voltage also require to use an operational amplifier but even this has a drawback: the measurement needs some time to be stable. This happens because of the association of the resistor with the input capacitance of the operational amplifier. The time needed for the stabilization depends on the multiplication of the value of resistor by the value of the input capacitance. The bigger this product is, the longer this time will be.

Nevertheless, this method has the advantage of being used almost anywhere in the circuit.

Setting up this method consists in finding the good resistors that will not produce a too big burden voltage to allow the measured circuit to operate normally but big enough to be able to measure it.

  1. Feedback ammeters

Source : « National Instruments » (figure 4 of the article of National Instruments about the minimization of measurement errors of small currents)

This method works a bit differently but keeps the main idea of converting the current to a voltage with a resistor as you can see on the figure above. We measure the voltage called Vout on the figure which is proportional to the current Iin which is the measured current and Rf, the resistor used for the conversion.

This method has the advantage of allowing to choose a bigger resistor in order to have a bigger voltage. This is possible because this voltage has no influence on the tested circuit. This avoid us other problems such has the thermal noise.

It also reduce the problem of burden voltage, indeed, it depends only on the amplifier used. The burden voltage is generally in the range of the µV whereas the burden voltage of the shunt ammeters can reach one volt.

Since we use an operational amplifier, we also have a problem with the stabilization time of the measure but here the resistor is in the feedback loop so the effective resistor is smaller. The measurement can therefore be faster but the slew rate of the amplifier has to be adapted too.

Our following step is to build the best solution for our AmpeROSE based on these methods.