Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
alphp committed May 9, 2021
1 parent 8d7a48f commit 06ae31d
Show file tree
Hide file tree
Showing 28 changed files with 463 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Fawno

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[![GitHub license](https://img.shields.io/github/license/fawno/HiDANCE)](https://github.com/fawno/HiDANCE/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/fawno/HiDANCE)](https://github.com/fawno/HiDANCE/releases)
[![Packagist](https://img.shields.io/packagist/v/fawno/HiDANCE)](https://packagist.org/packages/fawno/hidance)
[![Packagist Downloads](https://img.shields.io/packagist/dt/fawno/HiDANCE)](https://packagist.org/packages/fawno/hidance/stats)
[![GitHub issues](https://img.shields.io/github/issues/fawno/HiDANCE)](https://github.com/fawno/HiDANCE/issues)
[![GitHub forks](https://img.shields.io/github/forks/fawno/HiDANCE)](https://github.com/fawno/HiDANCE/network)
[![GitHub stars](https://img.shields.io/github/stars/fawno/HiDANCE)](https://github.com/fawno/HiDANCE/stargazers)
[![Documentation](https://img.shields.io/badge/documentation-blue)](docs/documentation.md)

# HiDANCE E-meters interface in PHP

Simple interface in PHP to interact with HiDANCE E-meters
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "fawno/hidance",
"description": "HiDANCE E-meters",
"minimum-stability": "dev",
"require": {
"blamebutton/php-serial": "dev-master"
}
}
100 changes: 100 additions & 0 deletions docs/J7-H/J7-H.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# HiDANCE J7-H USB Energy Meter

## Production Description
Measurement Ranges (and resolution accuracy):
- Voltage: 3.60 - 32.0 V (0.01 V)
- Current: 0.00 - 5.00 A (0.01 A)
- Capacity accumulation: 0 - 99999 mAh (0.001 Ah)
- Power accumulation: 0 - 9999.99 Wh (0.01 Wh)
- Power calculation: 0.00 - 160.00 W (0.01 W)
- Impedance: 0.0 - 6000.0 $\Omega$ (0.1 $\Omega$)
- Temperature: 0 - 100 ºC (1 ºC)
- Timing time: 999:59:59 (1 s)
- USB D+ voltage: 0 - 3.30 V (0.01 V)
- USB D- voltage: 0 - 3.30 V (0.01 V)

## Product Details:
- Input Interface: USB
- Output interface: USB
- Timed charge reminder settings: 24-hour countdown
- Full charge threshold parameters: < 2 W / 0.5 hours
- Refresh time: > 500ms / time
- Measurement rate: about 0.5 time / s
- Alarm mode: siren sound
- Display type: IPS Color Screen
- Product dimensions: 76 x 30.5 x 15.6 mm
- Current consumption: < 0.02 A
- Operating temperature: -10 to +60 ºC
- Working humidity: 10 to 80 (no doubt)
- Work oppression: 80 - 106 Kpa

## KEY Button Description
1. Long press the key button to flip the screen (180 degree flip)
2. Double-click the capacity(Ah) to clear zero.
3. Three-click the Quantity of electric charge(Wh) is clear zero.
4. Four-click time is clear zero.
5. Five-click timing settings.

Switch between different display interfaces by clicking the button

## Software download address:

[E-meter](http://www.mediafire.com/folder/31bc15uhq8odb/E-meter)
Supports Android phones and IOS phones

## SDK

##### Record structure:

| Offset | Meaning | Scale Unit | Data format | Stored |
|--------|-------------------------|------------|----------------|:------:|
| 0000h | Data mark (0xFF550103) | | char[4] | |
| 0004h | reserved | | char | |
| 0005h | V+ | 1/100 V | unsigned word | |
| 0007h | V- | 1/100 V | unsigned char | |
| 0008h | Current (I) | 1/100 A | unsigned word | |
| 000Ah | reserved | | char | |
| 000Bh | Capacity | 1 mAh | unsigned word | Yes |
| 000Dh | Energy | 1/100 Wh | unsigned dword | Yes |
| 0011h | D- | 1/100 V | unsigned word | |
| 0013h | D+ | 1/100 V | unsigned word | |
| 0015h | Temp | 1 ºC | unsigned word | |
| 0017h | Hours | 1 h | unsigned word | Yes |
| 0019h | Minuts | 1 min | unsigned char | Yes |
| 001Ah | Seconds | 1 s | unsigned char | |
| 001Bh | Back Light (BL) | 1 s | unsigned char | Yes |
| 001Ch | Overvoltage alarm (V>) | 1/100 V | unsigned word | Yes |
| 001Eh | Undervoltage alarm (V<) | 1/100 V | unsigned word | Yes |
| 0020h | Overcurrent alarm (I>) | 1/100 A | unsigned word | Yes |
| 0022h | Power Factor | 1/100 | unsigned char | |
| 0023h | reserved | | char | |

##### Commands
| Command | Send | Receive |
|----------------|-------------------------------|-------------------------|
| Electric Reset | FF 55 11 03 01 00 00 00 00 51 | FF 55 02 03 01 00 00 42 |
| Capacity Reset | FF 55 11 03 02 00 00 00 00 52 | FF 55 02 03 01 00 00 42 |
| Time Reset | FF 55 11 03 03 00 00 00 00 53 | FF 55 02 03 01 00 00 42 |
| All Reset | FF 55 11 03 05 00 00 00 00 5D | FF 55 02 03 01 00 00 42 |
| Setup | FF 55 11 03 31 00 00 00 00 01 | FF 55 02 03 03 00 00 4C |
| Enter | FF 55 11 03 32 00 00 00 00 02 | FF 55 02 03 03 00 00 4C |
| + | FF 55 11 03 33 00 00 00 00 03 | FF 55 02 03 01 00 00 42 |
| - | FF 55 11 03 34 00 00 00 00 0C | FF 55 02 03 01 00 00 42 |


##### Data formats

| Data format | Lenght | Byte order |
|-------------|--------:|------------|
| char | 8 bits | |
| word | 16 bits | Big endian |
| dword | 32 bits | Big endian |

## Images

![](img/001.jpg)
![](img/002.jpg)
![](img/003.jpg)
![](img/004.jpg)
![](img/005.jpg)
![](img/006.jpg)
Binary file added docs/J7-H/img/001.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/J7-H/img/002.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/J7-H/img/003.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/J7-H/img/004.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/J7-H/img/005.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/J7-H/img/006.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added docs/JDY-16/JDY-16 UUID Configuration.pdf
Binary file not shown.
Binary file added docs/JDY-16/JDY-16 v1.2 (English manual).pdf
Binary file not shown.
Binary file added docs/JDY-16/img/Dimensional drawing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/JDY-16-V1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/Null-modem emulator (com0com).jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/Pin definition.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/QR.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/Serial port tool.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/Termite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/JDY-16/img/WeChat Airsync debugging tool.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
12 changes: 12 additions & 0 deletions docs/documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Documentation

#### HiDANCE J7-H USB Energy Meter
- [J7-H User Manual](J7-H/J7-H.md)

#### JDY-16 High Speed Transparent Transmission Bluetooth Module
- [JDY-16 v1.2 (English manual)](JDY-16%20v1.2%20(English%20manual).pdf)
- [JDY-16 Master/Slave Transparente configuration](JDY-16%20Master%20Slave%20Transparent%20Transmission%20Configuration.pdf)
- [JDY-16 UUID Configuration](JDY-16%20UUID%20Configuration.pdf)

#### JDY-19 Ultra-low Power Consumption Bluetooth 4.2 BLE Module
- [JDY-19 Bluetooth Module Usage Manual](JDY-19/JDY-19%20Bluetooth%204.2%20BLE%20Module%20(v1.3).pdf)
4 changes: 4 additions & 0 deletions examples/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../src/jdy16.php';
require __DIR__ . '/../src/j7h.php';
8 changes: 8 additions & 0 deletions examples/raw2csv.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
require __DIR__ . '/autoload.php';

use Fawno\JDY\J7H;

$data = file_get_contents('data/jdy-20210509-0037.raw');
$csv = J7H::parse2csv($data, ';', true);
file_put_contents('data/jdy-20210509-0037.csv', $csv);
23 changes: 23 additions & 0 deletions examples/read.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
require __DIR__ . '/autoload.php';

use Fawno\JDY\J7H;

$jdy = new J7H('COM8');

//$filename = strftime('data/jdy-%Y%m%d-%H%M.raw');
$filename = null;

//$jdy->read();
//$jdy->record($filename);

echo $jdy->parse2csv('', "\t", true);
do {
$data = $jdy->read($filename);
if ($jdy->isData($data)) {
echo $jdy->parse2csv($data, "\t");
} else {
echo $data;
}
} while (!$jdy->isDisconnectedSignal($data));

Loading

0 comments on commit 06ae31d

Please sign in to comment.