Hello everyone.
I welcome you to my introductory post which I wrote as part of my participation in Experimenting with Current Sense Amplifiers Design Challenge. In this introductory blog post I will describe experiments which I want to do as part of this design challenge. Currently I am still awaiting the kit. UPS plane transporting my kit landed about two hours ago in Europe, so I expect it within few days. But even I have not seen it yet, I started preparing some software and PCBs which I want to use in my experiments.
About Me
I am student at FIT CTU at Prague. In my free time I contribute to element14 community. I have done some RoadTests. I like all microcontrollers ranging from simple 8-bit AVRs to most complex ARM SoCs and I like playing with them. While my primary interest is in IT, in last years I spend lot of time with electronics and especially digital electronics.
What is Current Sense Amplifier (CSA)?
At beginning it is nice to say what this series of blogs is about. In all my blog posts describing my experiments I will use MAX40080 CSA, so the good question is what the CSA really is?
TLDR: Current Sense Amplifier is electrical current sensor, something like digitally controllable amperemeter.
Long version: CSA is type of amplifiers which allows to measure very small voltage drop. It amplifies this small voltage. In case of MAX40080 it amplifies input voltage between -50 mV and +50 mV to output voltage between -1.25 V to +1.25 V. MAX40080 has also integrated ADC. This ADC converts amplified voltage between -1.25 V to 1.25 V to digital value between -4095 to 4095 in case of MAX40080. Finally, MAX40080 has serial interface for reading measured values by some external device. Practical usage of this sensor is when measuring electrical current flowing through some circuit. Generally, current is measured by amperemeter which is connected to the circuit in series. This is difference from voltmeter which is connected in parallel. MAX40080 sensor is connected to the circuit in series like any other amperemeter. This means that for measuring we need to disconnect circuit at some point and connect sensor there. Sensing of current is done by connecting resistor to the point. Sensor then measure voltage drop on this resistor. Voltage drop is liner with current due to ohm law. MikroE Click board used in this contest has integrated shunt resistor onboard. The shunt resistor has very low value (10 mOhm). It is because it should be invisible to the circuit (like standard amperemeter) and should not make significant voltage drop to the loaded circuit. The low value of resistor causes voltage drop to be also very low and this is reason why we use amplifier – Current Sense Amplifier.
My Experiment Plans
I plan to do four experiments ranging from basic experiments with measuring static current flowing by simple resistor to more advanced project measuring power consumption of some other part.
TLDR: I plan to do following 4 experiments:
- Initial simple experiment: Measuring current flowing by resistor, converting value returned by sensor and writing library.
- Raspberry Pi self-power consumption monitoring
- USB Type-C PD Current and Voltage monitoring
- Power consumption logging and electricity cost estimation
Initial simple experiment
This simplest project I want to do for gathering experiences with sensor communication interface, it features and learning calculations related to this CSA. In related blog post I plan to show code accessing and controlling sensor from Python on Raspberry Pi and reading measurements from the sensor. Following simplified block diagram visualize planed connection sensor in this experiment (note that diagram is very simplified and is missing important details, which I will describe later in related blog post):
In this blog I also want to show how to convert measured values to value in Amper and Volt units. While it sounds easy It is not totally trivial as in case of standard ADC calculation because sensor do not measure current directly but rather measure voltage drop on resistor. Calculation formula is affected by resistor value, ADC range, ADC resolution, amplifier gain, and it is not very trivial to calculate current from these values. At the time of writing this blog post I did not try my formula experimentally yet (because I did not receive device yet) but after some hours spend with datasheet, I probably understood calculation formulas and know how to do this, but it still will be surprised to me if my formula derived from datasheet parameters is correct. Expect this experiment and details as my first blog post soon.
Raspberry Pi self-power consumption monitoring
One of the more advanced projects which I plan to do is measurement of power consumption of Raspberry Pi that is sensor connected to. I will use Raspberry Pi to measure its own current consumption using MAX40080 sensor. Schematically I want to make something like this:
USB Type-C PD Current and Voltage monitoring
Second more advanced project which I want to do is measuring current flowing by USB Type-C cable. This project I consider as my main project and I used it’s name in my application. I want to design PCB emulating part of USB Type-C cable and exposing power lines to allow measuring VBUS voltage and flowing current. Schematically I want to make something like this:
USB Type-C PD is standard used by modern power adapters allowing negotiate voltage and current limits between both charger and device. My idea is to make PCB featuring two USB Type-C connectors and allowing me to view actual voltage and current that was negotiated by phone and charger (or other USB Type-C PD capable devices). In case of USB Type-C, voltage is not limited to static 5V and current limited to 500mA, so I hope that I will see some higher voltage currents in this experiment. I want to try use this experiment for experimenting with some advanced features of chip like overflow and underflow alerts.
Power consumption logging and electricity cost estimation
Finally, I want to do some experiment with some long-term monitoring and logging. In this experiment I want to try measure power consumption of my Wi-Fi router and try to use this sensor for estimation of electricity cost. Wi-Fi router has barrel jack connector, so in this experiment I will split connection between jack and adapter, and I will forward current over MAX40080 sensor. Because barrel jack is general it will not be limited to Wi-Fi Router (the only limitation is maximum voltage of 36V what comes from MAX40080 limits), but I found Wi-Fi router as a good example for long term monitoring. Schematically it will look as follows:
I think about other experiments which was not described above, and I will do them depending on level of my free time. For this reason, I will not disclose them now and I do not promise them, but I think that I will find time to at least one more surprise experiment.
Used Hardware
In my experiments I want to use Raspberry Pi and also I want to use microcontroller for some experiments. Because this contest sponsored by ADI/Maxim Integrated I will use MAX32625 MCU which I reviewed in this blog post. Because I will use microcontroller, I will write my own library for MAX40080 Current sense amplifier sensor. In fact, I do not need to do this because there are libraries provided by ADI/Maxim and MikroElekotronika, but I like creating my own libraries because it allows me to understand all details about sensor, its limitations, features and so on. In fact, I already started writing this library but because I did not received device yet, I can’t test it (and as all of us know, software newer works at the first run). I will publish it (and related blog post) as soon as I test it.
In experiments measuring self-power consumption of Raspberry Pi and USB Type-C I will use PCBs which I am designing at the time of writing this blog post. It will take to some time to manufacture them and deliver it to my home so expect results of these experiments later within contest period. Blogs about my basic experiment and my library I will write sooner.
And this is all from my introductory blog. Thank you for reading it and stay tuned to next blog posts. I like to hear what you think about may experiments, so kindly comment them in comments below.
Next blog: Blog #2: Introduction to MAX40080