EP-0116: Difference between revisions
Line 55: | Line 55: | ||
==How to Use== | ==How to Use== | ||
===HID Interface=== | ===HID Interface=== | ||
The HID interface is implemented using CP2112, please refer to for more information. [ https://www.silabs.com/interface/usb-bridges/classic/device.cp2112 ] | The HID interface is implemented using CP2112, please refer to for more information. [ '''[https://www.silabs.com/interface/usb-bridges/classic/device.cp2112 CP2112 Classic USB to HID Bridge]''' ] | ||
====API Reference==== | |||
[[File:An496-hid-usb-to-smbus-api-specification.pdf]] | |||
====Test Conditions==== | |||
DockerPi SensorHub and DockerPi Relay need to be installed on product DockerPi-H | |||
====Example Code==== | |||
<pre> | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Data; | |||
using System.Drawing; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Windows.Forms; | |||
using SLAB_HID_TO_SMBUS; | |||
namespace WindowsFormsApp1 | |||
{ | |||
public partial class Form1 : Form | |||
{ | |||
const ushort vid = 4292; //10C4 | |||
const ushort pid = 60048; //EA90 | |||
IntPtr connectedDevice; | |||
const byte RelaySlaveAddress = 0x20; | |||
const byte SensorSlaveAddress = 0x2E; | |||
ushort RelayStauts = 0; | |||
public Form1() | |||
{ | |||
InitializeComponent(); | |||
uint numDevices = 0; | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_GetNumDevices(ref numDevices, vid, pid); | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_Open(ref connectedDevice, 0, vid, pid); | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0x00 }, 2); | |||
timer_get_temp.Enabled = true; | |||
} | |||
private void RelayButton_Click(object sender, EventArgs e) | |||
{ | |||
timer_get_temp.Enabled = false; | |||
if (RelayStauts == 0) | |||
{ | |||
RelayStauts = 1; | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0xFF }, 2); | |||
} | |||
else | |||
{ | |||
RelayStauts = 0; | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0x00 }, 2); | |||
} | |||
timer_get_temp.Enabled = true; | |||
} | |||
private void Timer_get_temp_Tick(object sender, EventArgs e) | |||
{ | |||
byte bytesRead = 0; | |||
byte status = 0; | |||
byte[] readbuff = new byte[61]; | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_AddressReadRequest(connectedDevice, SensorSlaveAddress, 1, 1, new byte[] { 0x01 }); | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_ForceReadResponse(connectedDevice, 1); | |||
SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_GetReadResponse(connectedDevice, ref status, readbuff, 61, ref bytesRead); | |||
if(bytesRead == 1) | |||
{ | |||
progressBar.Value = readbuff[0]; | |||
} | |||
} | |||
} | |||
} | |||
</pre> | |||
===UART Interface=== | ===UART Interface=== | ||
===Bluetooth Interface=== | ===Bluetooth Interface=== |
Revision as of 15:14, 8 January 2020
DockerPi-H BlueTooth Board
Description
DockerPi-H is one of the expansion boards of the DockerPi series, which is usually used for independent work.
The derived HID interface, BLE interface, UART-TTL interface, and HID interface can be used for industrial control equipment.
This type of equipment does not allow drivers Program, but the HID interface solves this problem very well.
The IoT device is suitable for using the BLE interface.
This is a low-power resolution.
Traditional devices can use the UART-TTL interface.
DockerPi-H allows you to operate DockerPi series expansion boards without Raspberry Pi (or similar SBC).
It can connect your personal computer to DockerPi expansion boards and also allows you to wirelessly control DockerPi expansion boards.
This project is open source, you can modify it, redistribute it, and apply it to your product, but open source is not equal to free.
If you generate commercial value, please let us know. Failure to comply with open source rules may result in prosecution. legal liability.
Features
- Open source project (not for commercial distribution)
- DockerPi series products
- Programmable, can work with mobile phones, personal computers, industrial computers, ITX.
- Support BLE, HID, UART-TTL mode to transmit data
- Support BLE, UART-TTL data in ASCII mode
- Support transmission of UART-TTL, HID data in HEX mode
- HID does not require driver support
- It is recommended to install at the bottom of all modules
- Low power design
- BLE module provides FCC / CE certification
Supported platforms
- 1. Tested on mobile phones: IPhone 6s Plus, HUAWEI SCM-AL09
- 2. Test software: putty.exe(Windows Environment), minicom(Linux Environment), pyserial module(via USB-to-TTL cable)
GitHub Repository
- Repository URL: [ https://github.com/geeekpi/station ]
Gallery
- Product View:
- Application View:
Package Includes
- 1 x 3-Pin Header
- 4 x M2.5 nut
- 8 x M2.5 Copper stick
- 1 x Acrylic panel
- 1 x USB Micro data cable
How to Use
HID Interface
The HID interface is implemented using CP2112, please refer to for more information. [ CP2112 Classic USB to HID Bridge ]
API Reference
File:An496-hid-usb-to-smbus-api-specification.pdf
Test Conditions
DockerPi SensorHub and DockerPi Relay need to be installed on product DockerPi-H
Example Code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using SLAB_HID_TO_SMBUS; namespace WindowsFormsApp1 { public partial class Form1 : Form { const ushort vid = 4292; //10C4 const ushort pid = 60048; //EA90 IntPtr connectedDevice; const byte RelaySlaveAddress = 0x20; const byte SensorSlaveAddress = 0x2E; ushort RelayStauts = 0; public Form1() { InitializeComponent(); uint numDevices = 0; SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_GetNumDevices(ref numDevices, vid, pid); SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_Open(ref connectedDevice, 0, vid, pid); SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0x00 }, 2); timer_get_temp.Enabled = true; } private void RelayButton_Click(object sender, EventArgs e) { timer_get_temp.Enabled = false; if (RelayStauts == 0) { RelayStauts = 1; SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0xFF }, 2); } else { RelayStauts = 0; SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_WriteRequest(connectedDevice, RelaySlaveAddress, new byte[] { 0x01, 0x00 }, 2); } timer_get_temp.Enabled = true; } private void Timer_get_temp_Tick(object sender, EventArgs e) { byte bytesRead = 0; byte status = 0; byte[] readbuff = new byte[61]; SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_AddressReadRequest(connectedDevice, SensorSlaveAddress, 1, 1, new byte[] { 0x01 }); SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_ForceReadResponse(connectedDevice, 1); SLAB_HID_TO_SMBUS.CP2112_DLL.HidSmbus_GetReadResponse(connectedDevice, ref status, readbuff, 61, ref bytesRead); if(bytesRead == 1) { progressBar.Value = readbuff[0]; } } } }
UART Interface
Bluetooth Interface
Download SDK
- For IOS user
- nRF Toolbox Download Link: [ https://apps.apple.com/cn/app/nrf-toolbox/id820906058 ]
- For Android user
- nRF Toolbox Download Link: [ https://play.google.com/store/apps/details?id=no.nordicsemi.android.nrftoolbox ]
- For Sources code user
Development Method
- 1. Download SDK from the links mentioned before and install it to IOS device or Android device.
- 2. Open the nRF Toolbox app
- 3. Select "UART" icon and press "Edit"
- 4. Select one icon and input the execution code and press OK, and then press the icon will send the code to DockerPi Nightlight board.
- For example: Turn on NightLight board's first LED.
NightLight board's control bus is 1, I2C address is 0x15, and first LED register is 0x01, Turn on it by sending 0xFF
The execution code is: AA011501FF
The meaning of the code is: AA - starting code, Constant parameter, 01 means bus 1, 15 means I2C address 0x15, 01 means first LED register, FF eq 0xFF means Turn it on.
- 5. Press "Connect" to scan the DockerPi-H, and select it.
- 6.If the connection is successful, the blue LED will stop blinking and stay on.and you can see log by pressing "show log" link.
Product Includes
- 1 x DockerPi-H BlueTooth Board
- 1 x Acrylic Plate
- 1 x 3-Pin Pin Header
- 4 x M2.5 Nut
- 4 x M2.5 Screw
- 4 x M2.5x6 Copper Stick
FAQ
- Q: Should I connect DockerPi-H to my Raspberry Pi to make it work?
A: No, the DockerPi-H is seperated from Raspberry Pi, all you need to do is connect other DockerPi product such as Nightlight board or 4 channel relay board to it and control it via bluetooth.
- Q: Can I just using DockerPi-H to build my own project without other DockerPi product?
A: No, DockerPi-H is built for DockerPi series product so that you should have another DockerPi series product at least.
Keywords
- GeeekPi, dockerPi, dockerPi-H, bluetooth, BLE