Introduction: File Server With Current Meter

This is another INA217 current meter DIY project.

What is shown in the pictures above is Raspberry Pi (RPI) based file server.

I introduced the prototype RPI-based file server in the Instructable below.

https://www.instructables.com/Raspberry-Pi-NFS-and-Samba-File-Server/

The small capacity (About 600GB with 1 HDD and 1 SSD) of the old file server is not much use as a frequent full backup of data stored in my notebook is not much convenient.

Due to the lack of storage capacity, previously backed-up data should be deleted for storing a new full backup.

Therefore, I made this new upgraded file server with the 4TB Seagate Ironwolf HDD.

As the storage capacity of the new file server is quite satisfying, I’m using it from time to time for data backup, file storage, and a centralized media playing server.

While using this new file server, sometimes I’m wondering how much currents are utilized by RPI and HDD.

According to the technical specifications of RPI 3B/3B+, current consumption is about 260mA (Idle state) and up to 980mA (with 400% high CPU loads).

At the time of making this file server, I worried about the capacity of switching power supply.

Because the RPI can consume very high current (up to 2A) and 5.25-inch Seagate HDD also requires significant power (6.5watt) while operating.

Therefore, I used a high-rating switching power supply (12V/2.0A, 5V/5.2A) module for the file server.

But still, I’m wondering actually how much current is consumed by RPI and HDD while using the file server.

That’s why I am making this INA219-based current meter as a supplementary circuit to the read-made file server.

Let’s look into more detail about the current meter circuit.

Step 1: Schematics

As file server circuitry details are explained in another Instructable, I’ll focus on the INA219 current meter circuit in this story.

For your better understanding, the file server circuit consists of the following components.

-    High capacity (5V/5.2A, 12V/2.0A) two-channel switching power supply unit providing electricity for operating RPI and 5.25-inch HDD

-    5.25 inch HDD interfaced with RPI via SATA to the USB interface module

-    As 5.25 inch HDD requires 12V power for operating the platter motor and 5V to activate the HDD controller board, two different voltages of power supplies are required

-    RPI 3B+ installed with Linux operating system and support Samba file system service to connect with PC

-    Using the Windows explorer program, the 4TB HDD can be accessed via network-connected storage with the directory link such as “\\192.168.0.3\pi”

When the 4TB HDD attached to the PRI is connected as network storage, all directories and data stored in the HDD can be manipulated the same as the local storage integrated into a PC.

For the detailed operational scheme of Samba and file server service usages, please refer to the previously introduced Instructable mentioned in the step above.

The main topic of this Instructable is INA219 current meter circuit.

A similar current meter circuit is introduced in the other Instructable below.

https://www.instructables.com/Power-Supply-With-Current-Meters/

Although 16x2 LCD is used with the INA219 current meter in the circuit above, this time 4 digits 7-segment display is used in this project.

But the operational scheme of the current meter circuit is the same.

When the INA219 sensor is embedded in the plus(+) terminal of the power supply, the current flowing in the hotline (plus terminal) is sensed, and captured data is transferred via I2C communication lines to Arduino pro-mini board.

As I’m only interested in the current value, the presently flowing current level is displayed as mA (0000mA ~ 9999mA/9.9A) on the 4-digit 7-segment display.

As a common anode type of 7-segment module is used, the sketch program stored in the Arduino processing sensed data from INA219 to show mA values correctly on the 7-segment display.

I’ll explain the operational logic of the sketch program in the other step below.

Step 2: Parts

The main parts of the file server consist of many components listed below.

-    2 channel switching power supply (UP50DAC: 5V/5.2A, 12V/2.0A)

-    Seagate IRONWOLF 4TB SATA HDD 7200rpm

-    SATA to USB 3.0 hard-disk interface cable (HDD interface controller, 12V and 5V power supply inputs) support 3Gbps transfer rate

-    Raspberry Pi 3B+ controller board with cooling FAN circuit (Please refer to the previous Instructable for more details)

-    PCB, power switch, socket and cables, acrylic boards for equipment chassis

The current meter circuit consists of the following components.

-    Arduino pro-mini 5V 16MHz board

-    INA219 current sensor break-out board (5V, I2C interface)

-    Common anode 4 digit 7-segment display

-    Universal PCB, DuPont cable wires

For housing, all electronic components safely, thick (5T bottom side, 3T for cover) acrylic boards, and 4mm metal supports are tightly fixed with bolts and nuts.

Step 3: Sketch Program

When you look at step 1 – schematics, the 7-segment connected to the Arduino with 4 control lines (Arduino pin 9 ~ pin 12) and 7 data lines (Arduino pin 2 ~ pin 8).

As the 7 data lines are shared among 4 digits of 7-segment modules, each digit should be shown serially very short period (such as 5ms ~ 10ms).

When brief and sequential number showing continuously executed, the 4 digits number seems steadily shown on the 7-segment display as the explained picture above.

It’s a kind of visual trick that is widely utilized for showing a movie with a very long film consisting of many picture frames.

When you look at the picture in the middle, you can understand how the common-anode type 7-segment display is working.

For correctly displaying the number, the voltage state of 7 data lines should be correctly configured as shown sketch code below.

void disp_4() {

digitalWrite(pinA, HIGH);  

digitalWrite(pinB, LOW);  

digitalWrite(pinC, LOW);  

digitalWrite(pinD, HIGH);  

digitalWrite(pinE, HIGH);  

digitalWrite(pinF, LOW);  

digitalWrite(pinG, LOW); 

}

For example, the number 4 is displayed on the 7-segment by setting each data line voltage like above.

Also for displaying the number 4 in the rightmost position, the following sketch code should be executed.

void ON_1th() {

digitalWrite(D1, LOW);

digitalWrite(D2, LOW);

digitalWrite(D3, LOW);

digitalWrite(D4, HIGH);

}

Among the 4 control lines, only the D4 (Arduino PIN 9) voltage level becomes HIGH (5V) for enabling the rightmost position of the 7-segment.

When assuming the presently flowing current level is 1234mA, the leftmost digit (Decimal 1000 value) is calculated using the modulo (%) operator like below.

-    Firstly current value (1234mA) divided with 1000

-    Then temporal value from the division operation becomes 1

-    Then get the remainder by module (1%10) mathematical operation 

-    Finally, you can get the decimal 1000th position value 1

If you look at the modulo operator’s calculation scheme, you can understand how each digit number can be calculated,

For more details, please look at the sketch program attached to this step.

When you compare the sketch code with the flowchart above, maybe you can easily understand the overall current value displayed on the 4-digit 7-segment display.

Step 4: Operation and Conclusion

As the displayed current level is measured only by the 5V power supply line, the displayed value does not show all current flowing from the switch power supply module.

But all the main power-consuming circuitry is connected to a 5V power line (12V power is used only for activating the HDD platter motor), displayed current value can be deemed as a major power consumption result of the file server circuit.

As you can see in the video below, maximum power consumption reached about up to 1200mA (1.2A) while RPI booted and initialized HDD for connection.

https://drive.google.com/file/d/15iSnui1-gm5cXvDRFFYbaRaJRNiNXHdJ/view?usp=sharing

When heavy storage accessing command (such as running scp –r command from other RPI server) is used, I can about 1.8A of current flow sometimes.

But total current usage by RPI and HDD is not over the 2.0A level.

Finally, I can see how much current is consumed by RPI with a heavily over-loaded situation.

Thank you for reading.