• ### Display Cover in FreeCAD

I wanted to work with FreeCAD a long time. Yesterday I finally had the time and made the display cover for the adaptor-housing. It already has some additions, that I plan to make (touch controls for the menu) and therefore needs a bigger cut-out in the housing.

I will use the 3d-printer at the university to print a prototype and to see if everything works out as planned, because my experience with 3d-printing is very limited to say the least. The FreeCAD project files are added to the project page.

• ### Calibration demonstration

Here is the video to the calibration process. Have fun!

If you have any problems or feedback to the video, let me know.

• ### Finished Calibration Wizard

So yesterday I was able to finish the calibration wizard. Both offset correction and fine-trim work pretty well, as well as RMS voltage and current.

I am currently working on a short demonstration video, showing the process. I hope I get it done until tomorrow.

The current version is in the Github repository.

What comes next?

1.
As mentioned in a previous log, I plan to test the design for immunity against voltage / current transients. I am eager to see the results.

2.
A build-documentation will come. I ordered a few PCBs, which should arrive in the next days. Unfortunately, I haven't got another housing, so the current one has to suffice. I will keep you updated!

• ### AC Calibration: Conversion factors

In my previous project log, I wanted to send the calibration factor and the expected value directly to the teensy. I found it was easier to just calculate the conversion factor directly and send that value over. This saves some calculations and makes the overall program a little bit simpler.

And it works very well.

After plugging it in, you can measure the voltage with a multimeter (or just assume 230 V (more inaccurate)). The measured value van be entered into a value field.

The function the reads 10 values from the teensy and calculates the mean. The conversion factor is then calculated by

conv_factor = expected / rms_code      .

Because the conversion factors are usually in the range of 10^-6 to 10^-5. Because of the necessary accuracy, the bitwidth for the fixed-point values was increased to 24 bit, with 23 fractional bits. With a press on the red button, this value is then sent to the teensy, which stores it in its EEPROM.

At startup of the GUI, when connecting to the teensy, these values are synchronized.

The IRMS calibration works analogous.

Here is a screenshot of the VRMS calibration:

During the implementation, I found a missing key-feature. As proposed in the last weeks project log, I initially thought that only the calibration factors for the VRMS and IRMS calibration matter. In order to calculate the correct scaling value for the value measured by the IC, it is necessary for the user to enter the expected RMS value of either current or voltage.

To store these values, the Teensy-EEPROM will be used as well. The expected values are floating-point, so they have to be converted beforehand to an integer, that can be represented as a binary number (floating point too, but the conversion is more complicated). So I chose a fixed point format, which is used by the ACS as well. The conversion is very easy :

with the floating point number , and the number of fractional bits bw .

This can be stored very easily in the EERPROM and provides a good accuracy of 3.9mA for an 8-bit fractional part.

• ### Calibration Wizard GUI

Today was GUI-programming time. Functionality is not yet implemented, but the formulas are written down and waiting to be implemented and tested.

The wizard is accessible via a button next to the scope window. The serial bus instance is passed as an init-parameter, for sending and receiving data to and from the teensy. GUI programming (with tkinter) is a bit tedious, so I am happy to be done with the main workload in this matter. Next week it is finally ready to test!

On another matter: Immunity test

I've got the possibility to test this device with a surge generator (Schaffner NSG 623) for its transient immunity. In theory, it is able to withstand voltage spikes up to 3 kV. But first I will finish the calibration wizard and of course I have to study the handbook.

• ### Saving calibration settings

After running the calibration wizard, the calibration data must be saved.

For the calibration of the ACS71020, 6 values are required:

1. crs_sns for setting the coarse gain
2. sns_fine for the fine trim
3. qvo_fine to set the offset
4. pacc_trim for active power
5. VRMS calibration factor
6. IRMS calibration factor

The first 4 values are stores in the chips own memory. The IRMS and VRMS calibration factors are set in the code directly. To enable changing these values without reprogramming the teensy, another way of storing these values has to be chosen.

Last week, I was searching the ACS-chip for empty memory locations. A much easier solution is to use the internal EEPROM of the Teensy 4.0, which can store up to 1080 bytes of data. EEPROMs are known to be limited in write-cycles (100 000 cycles in this case), but usually a calibration won't be done that often anyways. Both calibration factors are only 32 bytes each, so there is enough space left.

EEPROM-access

The internal EEPROM can be accessed with the EEPROM-library easily. Each write stores 1 byte at a given address, so 4 writes have to be done in total. Reading values is analogous. An mcu_read() and a mcu_write() function serve as a wrapper to take care of this task.

Of course, a command from the serial input should be able to set those values as well.

Function changes

The calcVRMS and calcIRMS function both use the calibration factors. The constants are now variables. Everything else remains the same under the assumption, that AC calibration will be done with 230Vrms.

• ### Calibration wizard - first thoughts

The calibration wizard will be implemented similar to the waveform view, in a separate window.
It will guide through the calibration process, by calculating recommended settings, which can be accepted or ignored. The following calibrations have to be done:

1. Voltage
1. RMS with a calibration factor
2. Current
1. RMS with a calibration factor
2. Raw Values in terms of
1. Coarse Gain
2. Offset
3. Fine trim

I will try to present the first results until the end of the next week.

• ### PCB-changes and calibration wizard update

While thinking about the calibration wizard, the idea occurred to me, that empty EEPROM-space may be used to store user data. For example the calibration date. So I added read and write functions for whole addresses, to see if it works.

It does work with unused EEPROM-Space, for example register 0x0F bits 20-23. Other unused bits may be used as well. They can be accessed by using the writeEEPROMValue function, with a 32-bit mask, where the corresponding bit-positions are 0.

Datalogging

For long-term datalogging, an SD card can be used. Because the space is somewhat limited, for such a bulky SD card, a 6-pin header was added. The SD-card can be mounted anywhere in the housing and connected to them, just like the display. And I added pin-descriptions, because I they were missing.