Skip to content

E-Formula electric energy meter for Formula Student Korea

License

Notifications You must be signed in to change notification settings

luftaquila/fsk-energymeter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Formula Student Korea Electric Energy Meter

0. Features

  • Records following data:
    • HV bus voltage
    • HV bus current
    • LV supply voltage
    • Ambient (CPU) temperature
    • Real-world time of each record
  • 100 Hz sampling rate
  • Mounted as a USB Mass Storage device
  • Data viewer available on most platforms

1. Specifications

MIN TYP MAX UNIT
Supply voltage1 6 28 V
Power consumption 0.25 0.5 W
HV bus voltage 0 600 V
HV bus voltage resolution 0.24 V
HV bus current -750 750 A
HV bus current resolution 0.64 A
Operational temperature -10 80 °C
IP rating IP 20
Startup time 570 700 ms
Record interval 10 15 ms
Possible data loss
on power brownout
0 100 ms

1 When powered by USB, the device can startup with a minimum supply voltage of 4.5 V.

2. Connectors

LV HV
Model T4145415051-001 39291028
Image
Mate T4113402051-0001 5557-02 and 5556T
Pinout 1: D-   2: D+
3: N/C   4: VIN
5: GND
1: HV+   2: HV-

1 T4111402051-000 is also mountable, but it is highly recommended to use the T4113402051-000.

Wiring

The data cable and the drive cable are two distinct cables. When driving the vehicle, connect the drive cable to the LV connector of the FSK-EEM device. When extracting the data, disconnect the drive cable and connect the data cable instead.

Caution

Misconnection of the pins may cause permanent damage to the device.

Tip

The easiest way to make a data cable is to cut a USB cable with Type-A connector on one end.

3. Usage

3-1. Record data

When driving the vehicle, connect both HV cable and drive cable to the FSK-EEM device. The drive cable should supply VIN >= 6V to the device to start as a record mode.

The device performs a zero calibration of the HV voltage and current during the startup sequence. Once the calibration is complete, it continuously measures data every 10 ms.

The recorded data is updated to the file every 100 ms. During the file update, next measurement may be delayed up to 5 ms.

A new log file is created with each power cycle; each log file corresponds to a single power session.

Important

Make sure that the HV voltage and current are at 0V and 0A until the startup is complete.

Note

The device uses its internal clock to record the actual time of the measured data. As the clock accumulates errors over time, you should synchronize the time with FSK-EEM Viewer if you're using it after a long period. If the time keeps resetting to May 12, 1999, the battery should be replaced.

3-2. Extract data

To extract the recorded data from the device, disconnect drive cable from the device and connect data cable instead. There is no need to disconnect the HV cable during data extraction.

Plug the USB side of the data cable to the PC, or smartphone with a Type-A to C adapter. The FSK-EEM USB Mass Storage will appear in a while.

The log files are stored in the drive like a common USB memory. Copy the files to your PC.

Important

The timestamp part at the beginning of the log file's name is important to calculate the actual timestamp. Do NOT edit the filename of the *.log file. JSON or CSV files are not affected.

Note

The drive is read-only and you cannot edit or delete the stored logs in the file explorer.

3-3. View data

Go to the online viewer and open the log file to view the recorded data as a graph, or export the log as a human-readable JSON/CSV format.

Note

If there is no Internet connection, download html or executable from the release in advance.

3-4. Configure the device

In the FSK-EEM Viewer's Device Configuration section, click the Connect button and select the FSK-EEM device to connect.

The device's UID and the current time will be displayed on successful connection.

  • Sync RTC button synchronizes the device clock with the host computer.
  • Delete button deletes ALL files stored in the device. This button will be active only if the Unlock button is clicked.

Unplug and re-connect the device to see the change after the delete.

Warning

The delete action cannot be undone.

4. DIY

4.1 Build hardware

  1. Download fsk-energymeter-pcb.zip from the latest release and extract it.
  2. Place a JLCPCB PCBA(SMT) order using the GERBER, BOM and CPL files at the The gerbers/ directory.
  3. Solder following parts manually to the device after the PCB arrives.
  4. Insert a CR1220 battery and a Micro SD card to each slots on the PCB.

4.2 Upload firmware

  1. Download fsk-energymeter-firmware.zip from the latest release and extract it.
  2. Connect ST-Link's 3V3, GND, SWCLK, SWDIO pins to the same pins at the FSK-EEM's debug pin header.
  3. Run flash.bat to flash the release firmware to the device.

4.3 3d-print housing

  1. Download fsk-energymeter-3d.zip from the latest release and extract it.
  2. 3d-print both top.stl and bottom.stl files.

4.4 Final assembly

TODO

5. Development

Note

This section is NOT REQUIRED in general, and is for developers who want to modify the firmware or the viewer on their own.

5-1. Firmware

click to expand

Prerequisites

  1. Clone repository

    git clone https://github.com/luftaquila/fsk-energymeter.git --recursive
  2. Make sure the arm-none-eabi-gcc, openocd and make executables are in the $PATH.

Build and upload

cd fsk-energymeter/device/firmware
make program  # release build
make debug    # debug build

5-2. Viewer

click to expand

Prerequisites

  1. Node.js >= v20
  2. Rust >= 1.81.0
  3. Clone the repository and install dependencies
    git clone https://github.com/luftaquila/fsk-energymeter.git --recursive
    cd fsk-energymeter/viewer/web
    npm install
    cd ../native
    npm install

Build and run

  • Web

    cd fsk-energymeter/viewer/web
    python -m http.server 80  # open http://localhost
  • Native

    cd fsk-energymeter/viewer/native
    npm run tauri dev    # run
    npm run tauri build  # build executables

6. Troubleshootings

1. FSK-EEM USB Mass Storage takes too long to be mounted on the host

The FSK-EEM uses the STM32F401, which implements a USB Full Speed PHY. It is decades-old technology with a maximum transfer speed of 12 Mbit/s. However, in the real world, the actual speed is around 4 Mbit/s or 0.5 MB/s.

When you connect the FSK-EEM to your host PC, it will try to load the FAT table of the SDMMC. The FAT32 FAT table is typically a few megabytes, so it will take ~20 seconds to mount.

To reduce the mount time, use SD cards with smaller capacities or format them with larger cluster sizes.

The RTC sync or record delete functions will work immediately regardless of this limit.

2. Web Serial API not supported error on the FSK-EEM Viewer.

FSK-EEM Viewer's Device Configuration tab uses the Web Serial API to talk with the device, which has limited support across the platforms and browsers.

On macOS, the native app uses the Safari for its WebView, which does not supports the API. The web version(URL or html file) of the FSK-EEM Viewer will work on the Chrome browser.

On Android and iOS, the API is not supported from the OS layer. Use the desktop version of the viewer to configure the device.

7. LICENSE

"THE BEERWARE LICENSE" (Revision 42):
LUFT-AQUILA wrote this project. As long as you retain this notice,
you can do whatever you want with this stuff. If we meet someday,
and you think this stuff is worth it, you can buy me a beer in return.

이 저장소의 모든 내용물은 얼마든지 자유롭게 사용할 수 있습니다.
이 프로젝트가 마음에 든다면, 언젠가 우리가 만나게 되었을 때 맥주 한 잔 사 주세요.