ElectronicLoad: Difference between revisions

From RevSpace
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
   {{Project
   {{Project
   |Name=ElectronicLoadV2
   |Name=ElectronicLoad
   |Picture=ElectronicLoadV2.png
   |Picture=ElectronicLoadV2.png
   |Omschrijving=Software voor Electronic Load R2
   |Omschrijving=Software voor Electronic Load
   |Status=Completed
   |Status=Completed
   |Contact=bertrik
   |Contact=bertrik
Line 11: Line 11:


This page is about software I'm writing for my brother who is developing an 'electronic load'.
This page is about software I'm writing for my brother who is developing an 'electronic load'.
An electronic load is a thing that draws current from a power source in a well-defined way.
An electronic load is a device that draws current from a power source in a well-defined way.


A possible use case for an electronic load is to discharge a battery with a constant current, while recording the voltage so you can make a nice discharge graph.
Possible use cases:
* discharge a battery with a constant current, while recording the voltage so you can make a nice discharge graph and verify the total battery capacity.
* characterize a solar panel, measuring the voltage while sweeping the current, to find the point where it delivers most power.
* just measure current drawn by a device, at a high time resolution, and determine the amount of charge used per use cycle.
* draw a pre-defined current waveform from a battery, e.g. to simulate the current drawn by a mobile phone (short high current peaks, with longer plateaus in between)


Another user case is to test a solar panel, drawing variable current from it while measuring the voltage, to find the point where it delivers most power.
Stuff to investigate:
 
* investigate the SCPI protocol: https://www.circuitspecialists.com/images/ARRAY%20372x%20Series%20Electronic%20Load%20SCPI%20%20Programming%20Guide.pdf
Perhaps yet another use case is just to measure current drawn by a specific device at a high time resolution, and determine the amount of charge used per use cycle.
* https://hackaday.com/2021/11/17/scpi-on-teaching-your-devices-the-lingua-franca-of-laboratories/
* https://www.eevblog.com/forum/projects/smuview-a-sigrok-gui-for-power-supplies-multimeters-and-more/
* inspiration: https://community.element14.com/technologies/test-and-measurement/b/blog/posts/programmable-electronic-load---scpi-interface-and-error-handling


== Design ==
== Design ==


=== Hardware ===
=== Hardware ===
For the hardware design, see http://sikken.nl/electronicloadr2.html
For the hardware design, see https://www.tindie.com/products/jaspersikken/jaspers-electronic-load-r3/


The basic principle of operation is that the electronic load has a circuit with a mosfet controlled by a microcontroller to draw a configurable constant current.
The basic principle of operation is that the electronic load has a circuit with a mosfet controlled by a microcontroller to draw a configurable constant current.
Line 33: Line 39:


=== Software ===
=== Software ===
The [https://github.com/bertrik/ElectronicLoadR2 source code is on github].
The [https://github.com/bertrik/ElectronicLoad source code is on github].
 
Building blocks:
* USB serial port, to receive commands from the user
* command interpreter, to transform user input into actions
* measurement loop, that continuously calculates voltage and current, and integrates them (from mA to mAh for example)
* control loop, that maintains the desired behaviour (constant current, power, resistance)
* logging logic, to log measured values to the output
* sequencing logic, to perform the steps needed for particular measurement mode, e.g. solar panel characterisation


=== Random thoughts ===
=== Random thoughts ===
Line 55: Line 53:
* automatically reset cumulative counters when starting a log
* automatically reset cumulative counters when starting a log
* conversion from SI units to other units, like mAh, Wh, etc?
* conversion from SI units to other units, like mAh, Wh, etc?
* use SCPI to allow the electronic load to be controlled by a script or a GUI device, the script can then do intelligent stuff like sequencing through a battery capacity measurement cycle, solar cell P-V cycle, etc


== Platform IO ==
== Platform IO ==
Line 63: Line 62:
=== Installation ===
=== Installation ===
First you need to install pip, e.g. for debian Linux:
First you need to install pip, e.g. for debian Linux:
   sudo apt-get install python-pip
   sudo apt install python-pip


Then you can use pip to install platformio
Then you can use pip to install platformio
Line 72: Line 71:
=== Platformio commands ===
=== Platformio commands ===
Just 'cd' into the directory containing the platformio.ini file.
Just 'cd' into the directory containing the platformio.ini file.
Platformio will automatically download and cache any requirements (like dependent libraries, tool chains, upload utilities, etc).
Instead of typing platformio you can just type pio.
Instead of typing platformio you can just type pio.
To just compile the software and download dependencies:
  pio run


To compile and upload the firmware:
To compile and upload the firmware:
   pio run --target upload
   pio run --target upload
Platformio will automatically download and cache any requirements (like dependent libraries, tool chains, upload utilities, etc).


To run the serial monitor:
To run the serial monitor:

Latest revision as of 22:05, 28 November 2021

Project ElectronicLoad
ElectronicLoadV2.png
Software voor Electronic Load
Status Completed
Contact bertrik
Last Update 2021-11-28

Intro

Status: the software works! (but there are always more features to add ...)

This page is about software I'm writing for my brother who is developing an 'electronic load'. An electronic load is a device that draws current from a power source in a well-defined way.

Possible use cases:

  • discharge a battery with a constant current, while recording the voltage so you can make a nice discharge graph and verify the total battery capacity.
  • characterize a solar panel, measuring the voltage while sweeping the current, to find the point where it delivers most power.
  • just measure current drawn by a device, at a high time resolution, and determine the amount of charge used per use cycle.
  • draw a pre-defined current waveform from a battery, e.g. to simulate the current drawn by a mobile phone (short high current peaks, with longer plateaus in between)

Stuff to investigate:

Design

Hardware

For the hardware design, see https://www.tindie.com/products/jaspersikken/jaspers-electronic-load-r3/

The basic principle of operation is that the electronic load has a circuit with a mosfet controlled by a microcontroller to draw a configurable constant current. The mosfet is attached to a heatsink that dissipates the power as heat.

The microcontroller can set the desired current, measure the actual current and measure the voltage. This way we can also do other modes than just constant current:

  • constant power mode: from the voltage measured, we can calculate the current required to draw a constant power
  • constant resistance mode: from the voltage measured, we can calculate the current to emulate a specific resistance

Software

The source code is on github.

Random thoughts

Features to implement:

  • sequencer for stepping through a specific range of currents at a specific speed
  • operating modes:
    • add sequenced modes: special sequences for measuring a PV-cell, measuring a battery, measuring a Peltier?
    • automatic max power point determination?
  • calibration
    • automatic if possible, e.g. set current to 0, measure current, use this as an offset?
    • manual if required
    • save calibration values in non-volatile memory and load them at startup
  • automatically reset cumulative counters when starting a log
  • conversion from SI units to other units, like mAh, Wh, etc?
  • use SCPI to allow the electronic load to be controlled by a script or a GUI device, the script can then do intelligent stuff like sequencing through a battery capacity measurement cycle, solar cell P-V cycle, etc

Platform IO

platformio is a kind of build environment. It takes out the guesswork/manual steps of using the Arduino environment to pick the right board, libraries and options. All of this can now be specified in text files (e.g. platformio.ini) and separately per individual project.

Installation

First you need to install pip, e.g. for debian Linux:

 sudo apt install python-pip

Then you can use pip to install platformio

 sudo pip install platformio

Also make sure you install and activate the udev-rules, according to the platformio-udev-rules description on the platformio page.

Platformio commands

Just 'cd' into the directory containing the platformio.ini file. Platformio will automatically download and cache any requirements (like dependent libraries, tool chains, upload utilities, etc). Instead of typing platformio you can just type pio.

To just compile the software and download dependencies:

 pio run 

To compile and upload the firmware:

 pio run --target upload

To run the serial monitor:

 pio run --target monitor

or

 pio device monitor