Conversation
|
Thanks for addressing this @Known4225 ! |
|
From testing, it turns out that the data error issue only appears on the AMDS current card and AMDS high voltage card. The branch has been updated to add two new functions to the amds driver, These functions offer a more convenient way to get amds data. Rather than having to convert the raw data yourself, the amds driver can convert the data into volts or amps if given the card type that is being read from. The functions |
There was a problem hiding this comment.
Thanks @Known4225.
I flagged a few things below.
Revising our measurement approach
In addition to that, I have one major comment for revision: all of our cards (current, low voltage, high voltage), we have analog circuitry that conditions the signal that is applied to the circuit board before the ADC sees it. This circuitry is sometimes customized on a per test stand basis. I think we should be thinking of measurements through the AMDS as a two step process:
- Step 1: read the raw voltage from the ADC. This should be voltage at the ADC terminals, not the voltage before the op-amp stage.
- Step 2: convert the raw voltage from the ADC into the measured quantity.
Step 1 function
I think your function amds_get_voltage should be our step 1 function.
Step 2 function
Some comments on this step 2:
- For current measurement, this is indeed as you have implemented within
amds_get_current(). However, in all of our research test stands, we have users measure their own sensor offset and gain as described in this AMDC doc. In addition to being more accurate, people often will wrap their phase cable around the hall sensor multiple times which means that their volts-to-amps gain will be scaled by a multiple of the number of wraps. - For low voltage measurement, I can see from the schematic that we should have
out = (measured - 2.048)*10.0; - For high voltage measurement, it will be a similar expression to the current measurement, but the schematic indicates different resistors in the feedback network, so presumably different gains/offset (I have not checked these gains, but we can do that when we settle on our approach here).
So let's create a second function (or macro!) that converts the raw voltage obtained from amds_get_voltage into the measured quantity. Maybe amds_get_measurement. I think this function (or macro!) should go like this:
int amds_get_measurement(double v_in, double offset, double gain, double *out)
{
out = (v_in - offset)*gain;
return SUCCESS;
}Note that I am formulating this function as (v_in - offset)*gain; to match the discussion here.
This should probably be a macro or inline function, right?
Set up some defines
I think we should have #defines for the default offset and gain set up for each of these boards.
We may also want to include a version of amdc_get_measurement that uses the default define values... hmm...
Remember
To test this all out and make sure it is working right.
|
It turns out the BNC connector was an output not an input. But I also haven't had any luck with wires connected to the screw terminals |
|
Thanks @Known4225. I am worried about how hot your ST MCU is running. Any resolution on this? Can you try measuring the temperature on a board we are using in a power cabinet? |
|
Update on heat situation. Daehoon believes a permanent short has occurred within the STM32 or in the components around it. This short is thought to be caused by plugging in the Low Voltage Card SN:03 into the card slot 1. We damaged another AMDS board (SN:15), possibly permanently, to find out this information. Current draw (broken AMDS): 0.285 Amps Current draw (working AMDS): 0.17 Amps Normal AMDS STM runs at ~94 degrees F. Broken AMDS can get up to 200 degrees F. But the hot AMDS isn't broken in the sense that it doesn't work, it still works just fine. |
|
02/20/25:
Step 1 will be done automatically by the function Step 2 will be done by the function |
|
Update low voltage and high voltage docs to provide user equation relationship between adc voltage and input voltage (like the current card docs have now). Equation should express input voltage as a function of adc voltage. Review default values with Daehoon to ensure that they are based on the schematic. Add default values for both revisions of current cards. |
|
4.03.25: Meeting with Daehoon. The theoretical values for offset and gain based on this report (where the relevant section of the schematic is identical across the current card and high voltage card) do not agree with the experimental ones (offset is fairly similar, gain is off by a factor of 10). We found that the resistors on the high voltage card that I'm using (no SN on it) has the wrong resistor values for resisto R4, R6, and R8. All of the values of these resistors are 4.3k ohms when they should be 10k, 8.45k, and 4.64k respectively. Even with the incorrect resistor values we were not able to calculate a theoretical offset and gain that agreed with the experimental values. |
|
@Known4225 -- curious.... I created this issue to update the docs: Can you and @Daehoon-Sung work on adding comments with the expected expressions for each board? |
|
I can confirm that the calculated experimental values for the low and high voltage cards are working. I was unable to confirm values for either current card because I once again broke the AMDS in the same way. The STM gets extremely hot immediately when powered. I'm not sure what causes this issue to happen but even with no cards plugged in, SN13 gets to extreme temperatures within 0.5 seconds of being powered, though the board is still fully operational. Perhaps this happened because I unplugged the current card while the AMDS was capturing. Either way, I feel like I should stop doing these experiments because I just keep breaking everything. Also, should we use the default values for the high voltage cards according to the schematic, or our hardware? Since both high voltage cards that I have located have incorrect values for resistors R4, R6, and R8 (all of them are 4.3kΩ), I have put the default values according to our hardware and not the schematic, which calls for R4 = 10kΩ, R6 = 8.45kΩ, and R8 = 4.64kΩ. |
|
@Daehoon-Sung One last modification from experimental data, it appears that the Low Voltage Card's experimental offset should be 0 rather than 2.048. Here is the plot with an offset of 0 when sweeping from 2.0v to 3.0v.
and here's the plot with a 2.048 offset:
|
|
02.04.25:
Measured Resistor Values: |
|
Hello Professor @elsevers. I am not sure which part is wrong but after replacing it to other RevC current cards, the offsets show correct values. However, with the replaced board, the gain is 1/2 of the expected gain from the math I did based on the schematic. Measuring resistance using multimeter seems not a good idea since
Hello @Known4225. |
|
Hello , Professor @elsevers, @Known4225. I found out that the current sensor on RevC we used for the experiment is not
|
|
@Daehoon-Sung Can you confirm that the gain and offset numbers used in the BP4 cabinet are these current card rev C default values: if so, this PR can be merged |
|
Hello @Known4225. I just mentioned this in person and forgot to make a comment on this. sorry. The equation here is correct. If the board has different values on its gains or offsets, I suggest looking into whether the board actually has the same components as the schematic. As long as the board is working well and uses the same values of resistance and the same current sensors, the experimental results should match the theoretical equation. |
elsevers
left a comment
There was a problem hiding this comment.
I reviewed this with @Known4225 and @Daehoon-Sung on 4/14/2025 and we agree it is ready to merge. @Known4225 has tested these out on his local AMDC. @Daehoon-Sung plans to upgrade his research testbench to use this code prior to us releasing it.

















This PR closes #448.
It adds helper functions to the AMDS driver file that
Future work should update docs.amdc.dev to inform users about these functions.