XHC WHB03 WHB04 mpg support

Jogging keyboard, output board, MPG pendant, adapters, ...

XHC WHB03 WHB04 mpg support

Postby Moonglow » 10 Nov 2013, 12:37

I plan to add this kind of chinese MPG ( wireless WHB03, WHB04 and wired HB04, HB03 ) to Planet CNC and reveal some technical details for other who want to use it where they want...

First of all both of this device ( include wireless version ) looks in system like a HID device ( really two HID device one for read data... and another one for sending DRO through HID SetFeature request ).

Photos:
WHB03 HB03 ( it designed for NCStudio )
WHB03_L.jpg
WHB03
WHB03_L.jpg (14.57 KiB) Viewed 16770 times


WHB04 HB04( it designed for Mach3 )
whb04.jpeg
WHB04
whb04.jpeg (8.49 KiB) Viewed 16770 times


USB VID & PID
Code: Select all
WHB03:
VID: 0x10CE
PID: 0xEB6E

WHB04:
VID: 0x10CE
PID: 0xEB70


How can we know which of this two HID devices for read and which write ?
To select correct hid device you need check input report length field.. if this field is 6 it is our READ hid... and if feature report length is 8 it is our WRITE device... this is correct for BOTH device...

How to read device data ?
When you push the button... or spin the wheel... device send data to READ hid... and data format is:
Code: Select all
#pragma pack( push, 1 )
struct whb0x_in_data
{
   uint8_t      rep_id;
   uint8_t      btn_1;
   uint8_t      btn_2;
   uint8_t      wheel_mode;
   int8_t       wheel;
   uint8_t      xor_day;
};
#pragma pack( pop )


rep_id - it is our report ID ( value is 4 for both device )
btn_1 & btn_2 - button code... you can push TWO simultaneously...
wheel_mode - mode of handwheel ( you can choose it with positional switcher near to wheel )
Code: Select all
0x00 - position switch to off state
0x11 - position switch to X state
0x12 - position switch to Y state
0x13 - position switch to Z state
0x15 - position switch to Spindle speed state
0x14 - position switch to Feedrate speed state
0x18 - position switch to Processing speed state ( A-axis for HB04 )

wheel - it is direction and speed of wheel... when we spin wheel to CW dir it will be positive from 1 to 10 ( maybe little more... and this value based on current spin speed :) ) and when spin wheel to CCW value be negative from -1 to -10 ( based on spin speed too )
xor_day - very intersting value... it is a crypted DAY OF THE MONTH :mrgreen: this value settable with HID Set Feature and used as key for simple XOR crypt what used for very easy protection of they protocol...
how to resolve real day value ?
Code: Select all
day_value = btn_1 ^ xor_day;

Thats all i think...

How to write device data ?
All data writen to writable HID with HID Set Feature request... all data divided in 8 byte blocks and sent to device...

Data structure for both model's ( little difference in postition but all other is same )
Code: Select all
#pragma pack( push, 1 )
struct whb03_out_data
{
   /* header of our packet */
   uint16_t   magic;
   /* day of the month .. funny i know*/
   uint8_t      day;
   /* work pos */
   uint16_t   x_wc_int;
   uint8_t      x_wc_frac;
   uint16_t   y_wc_int;
   uint8_t      y_wc_frac;
   uint16_t   z_wc_int;
   uint8_t      z_wc_frac;
   /* machine pos */
   uint16_t   x_mc_int;
   uint8_t      x_mc_frac;
   uint16_t   y_mc_int;
   uint8_t      y_mc_frac;
   uint16_t   z_mc_int;
   uint8_t      z_mc_frac;

   /* speed */
   uint16_t   feedrate_ovr;
   uint16_t   sspeed_ovr;
   uint16_t   feedrate;
   uint16_t   sspeed;

   uint8_t    step_mul;
   uint8_t    state;

};

struct whb04_out_data
{
   /* header of our packet */
   uint16_t   magic;
   /* day of the month .. funny i know*/
   uint8_t      day;
   /* work pos */
   uint16_t   x_wc_int;
   uint16_t   x_wc_frac;
   uint16_t   y_wc_int;
   uint16_t   y_wc_frac;
   uint16_t   z_wc_int;
   uint16_t   z_wc_frac;
   /* machine pos */
   uint16_t   x_mc_int;
   uint16_t   x_mc_frac;
   uint16_t   y_mc_int;
   uint16_t   y_mc_frac;
   uint16_t   z_mc_int;
   uint16_t   z_mc_frac;

   /* speed */
   uint16_t   feedrate_ovr;
   uint16_t   sspeed_ovr;
   uint16_t   feedrate;
   uint16_t   sspeed;

   uint8_t    step_mul;
   uint8_t    state;

};
#pragma pack( pop )


About main fields:
magic - magic value indicate what it is a first packet and it is always 0xFDFE
day - day of the month :)... it will read back from readable HID... as we talk before... you can use it for your own needs..
#_wc_int - it is integer part of position... as example if position 135.17 we must fill it with value 135... and if our position is -77.89 we must put value 77 to this var... ( we always put POSITIVE value to this value )
#_wc_frac - it is 8bit for WHB03 and 16bit for WHB04 ... it is simple whan you look two display max frac part for WHB03 it is .99 and for WHB04 it is .9999 ... this value also have a SIGN bit if value is negarive you must set most significant bit to 1... little example:
WHB03
our X position is: -117.33
we put 117 to x_wc_int
we also put 33 to x_wc_frac
we have negative value... we also need to set most significant bit of x_wc_frac to 1...
Code: Select all
x_wc_frac = x_wc_frac | 0x80;

WGB04
our X position is: -220.3345
we put 220 to x_wc_int
we also put 3345 to x_wc_frac
we have negative value... we also need to set most significant bit of x_wc_frac to 1...
Code: Select all
x_wc_frac = x_wc_frac | 0x8000;

feedrate_ovr - our fedrate override value... just put something
sspeed_ovr - display our speed override value...
feedrate - current feedrate
sspeed - current speed
step_mul - it is step multiplier for our wheel... if we change it in software we can show this value to user...
Code: Select all
low nibble
0x00 - 0*1x
0x01 - 1*1x
0x02 - 5*1x
0x03 - 10*1x
0x04 - 20*1x
0x05 - 30*1x
0x06 - 40*1x
0x07 - 50*1x
0x08 - 100*1x
0x09 - 500*1x
0x0A - 1000*x

hi nibble ( can be combined with low )
0x10 - back to original
0x20 - floating on the knife(?)
0x50 - back to mechanical origin
0x60 - fine adjastment

it does not change wheel value from readable HID... it is just to notify user...
state - this is state value... used to notify user of state of our machine or if you need something from user...
Code: Select all
0x01 - Run state blink
0x02 - Pause state blink
0x80 ( 0x40) - flash yes/no leds ( only for WHB03 ? )

To send data you need to split it in 7 bytes blocks ( if latest block less than 7 you need add padding to it ) add first byte to this block it be report ID ( value must be 6 ) and then send it trought set feature request...

as example:
Code: Select all
our data is
00 01 02 03 04 05 06 07 08 09

we send it as
[06] 00 01 02 03 04 05 06
[06] 07 08 09 [00] [00] [00] [00]


[] - it added data

Power saving
After 30 seconds, device go to sleep mode ( screen will not update! )...


------------------------------------------------------------------------------------------------------
I think this information will useful for anyone who want to use this MPG with your own project and so on...
I already create some demo project to use this MPG with PlanetCNC... i will publish it soon as i make it more stable for testing... thnax


p.s: if anyone have a (W)HB04 ... PM me please
Last edited by Moonglow on 13 Jan 2014, 08:47, edited 7 times in total.
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 11 Nov 2013, 20:34

demonstration video here: http://youtu.be/qbmMgDM-Zkc

p.s: sorry for screen lags :) run under VMWare ( WinXP ) under Linux :)
Last edited by Moonglow on 12 Nov 2013, 07:05, edited 1 time in total.
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Bakha » 12 Nov 2013, 05:48

Moonglow wrote:demonstration video here: http://youtu.be/qbmMgDM-Zkc

:!: :!: :!:
Bakha
 
Posts: 165
Joined: 11 Jan 2012, 17:45
Controller: Mk2

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 18 Nov 2013, 18:10

first beta version released :D

xhc_bind.png
screenshot
xhc_bind.png (76.72 KiB) Viewed 16683 times


This tool support both HB03 & HB04 ( need to test ) based devices.
About INI file.
Code: Select all
use_planet_cnc_api:1 - use PlanetCNC API to send position and speed feedback to MPG.
hotkeys_app:"CNCUSBController.exe" - application name ( case sensitive  :!: ) used to identify which application needs to send hotkeys

hotkeys_delay_between:1 - time in ms beetween emulated key press...
hotkeys_delay_release:20 - time before we release our hotkey

BTN:_BTN_CODE_:"_HOT_KEY_"
WHS:_WHS_CODE_:"_HOT_KEY_"
WHEEL:_WHEEL_SHIFT_VALUE:"_HOT_KEY_"


About hotkeys ( hot key syntax is PlanetCNC like.. so it be easy to port your hotkey config to my app):
Code: Select all
F1-F24 - functional keys F1-F24
LCtrl - Left Control
RCtrl - Right Control
LShift - Left Shift
RShift - Right Shift
LAlt - Left Alt
RAlt - Right Alt
Left - Left Arrow
Right - Right Arrow
Up - Up Arrow
Down - Down Arrow
PageUp - Page Up
PageDown - Page Down
End - End key
Home - Home key

N0 - N9 - numpad numeric keys
D0 - D1 - keypad numeric keys
Space - Spacebar
Backspace - Backspace
Enter - Enter
Insert - Insert
Delete - Delete key
Pause - Pause
Add - + symbol
Sub - - symbol
Mul - * symbol
Div - / symbol
Dot - . symbol
A-Z - alphabet keys


ps: default configuration used to test your MPG just open notepad.exe and run this tool... you must always run tool AFTER application was runned. you will see also console window ( it is only for debug purpose ).

screenshot of the program more than its size :D :lol: :mrgreen:
xhc_bind.zip
0.1 beta version
(13.73 KiB) Downloaded 663 times
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby pjohnsonj » 19 Nov 2013, 15:50

Moonglow,

I think this is great! Just to confirm this is for the wireless or wired pendant versions? I am not a programmer but looks like the ini files can be easily modified to change simple things like a command set for a particular pendant key? Any way to post a diagram of pendant showing what buttons(btn?) are what? Can you explain this more is detail, "you must always run tool AFTER application was runned."

Thanks for your work on this. USBCNC really needed a ready to roll pendant with coordinate display!

Phil
pjohnsonj
 
Posts: 24
Joined: 11 Jan 2012, 13:08
Controller: Mk2

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 20 Nov 2013, 09:03

pjohnsonj wrote:Just to confirm this is for the wireless or wired pendant versions?

Yep it must works for both, wireless and wired devices.

pjohnsonj wrote: ini files can be easily modified to change simple things like a command set for a particular pendant key? Any way to post a diagram of pendant showing what buttons(btn?) are what? Can you explain this more is detail, "you must always run tool AFTER application was runned."

Yep i will explain it more, soon... about Buttons key codes you can see it in Debug In window than you push it on your MPG, i will post diagram for my HB03 based device too.
"you must always run tool AFTER application was runned."
This mean what you need ( for now ) run target app before xhc_bind
1. Run target app
2. Run xhc_bind
3. Use your MPG... ^)
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby jhoexp » 29 Dec 2013, 09:16

Tested tonight and it works with my XHC WHB04 wireless!!

Well, the comunication works from mpg to usbcnc, but the display on the pendant doesn't.

There are also some difficulties configuring it to jog correctly....i was only able to jog step by step, without speed changes.

Had to change the .ini configuration file to disable the single letter keystroke that were associated to some buttons (Like the "H" when STOP button is pressed on the pendant), because when i press them the focus goes to the MDI window and stay there, waiting for "enter" to execute command, stopping any other imput from the pendant. The other functions (pause, varius combo RCtrl + LAlt etc...) works perfectly.
jhoexp
 
Posts: 7
Joined: 29 Dec 2013, 01:30
Location: Italy
Controller: DIY Mk1

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 03 Jan 2014, 17:09

Hello jhoexp,

>>Well, the comunication works from mpg to usbcnc, but the display on the pendant doesn't.
Hm... try to add this registry fix ( fix_entries.reg ) from my thread viewtopic.php?f=16&t=923 and other thing... i do not have WHB04 on my hands for now... if you have time and you can allow me connect to your PC with TeamViwer i will like to find the problem :) just PM me and we can make this tool better

because when i press them the focus goes to the MDI window and stay there, waiting for "enter" to execute command, stopping any other imput from the pendant.
Yep... it is true i recomended to use combination keystroke for that... becouse single letter will goes to MDI window... and i do not know why.. ( maybe it has default focus )
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Andrej » 03 Jan 2014, 21:15

Moonglow wrote:... becouse single letter will goes to MDI window...

Because software thinks this letter is new MDI command.
Andrej
 
Posts: 2489
Joined: 10 Jan 2012, 16:09
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby jhoexp » 09 Jan 2014, 11:18

Success!
Tried with the .reg file you posted and running your app "as administrator" now I have the feedback on the DRO. Cool! 8-)

I have configured all the buttons, the axis selection, etc...everything is fine, except for the jogging itself.

It's working, but I am still not satisfied with it because I can't control how fast the machine is moving, just using the wheel (speeding it up or down). It's fine if I jog step by step or very slowly, but pratically you can't use the different speed just turning the wheel....

But I won't give up, will try different way to jog, assigning other command to every speed....

Anybody using it right now? Can you post your .ini file (i will asap) to see if you have done something better than me?
jhoexp
 
Posts: 7
Joined: 29 Dec 2013, 01:30
Location: Italy
Controller: DIY Mk1

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 10 Jan 2014, 16:19

>>jhoexp
That's nice! Can you share your xhc_bind config and keys config for PlanetCNC ?

It's fine if I jog step by step or very slowly, but pratically you can't use the different speed just turning the wheel....

PlanetCNC allow you select multiplier for JOGing... maybe i need to make possible add circular switch for specifed buttons ? You will push da button and it will send HottKeys from list one by one... and you can select different JOG multiplayer with one button.
something like this
Code: Select all
BTN:0x10:"G"+"H"+"K"

and each time you push button with code 0x10 you will first send G next send H next K and next again G etc...
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby jhoexp » 11 Jan 2014, 00:17

Moonglow wrote:>>jhoexp
That's nice! Can you share your xhc_bind config and keys config for PlanetCNC ?


Sure! I will post it as soon as I come back home tomorrow...

Moonglow wrote:PlanetCNC allow you select multiplier for JOGing... maybe i need to make possible add circular switch for specifed buttons ? You will push da button and it will send HottKeys from list one by one... and you can select different JOG multiplayer with one button.
something like this
Code: Select all
BTN:0x10:"G"+"H"+"K"

and each time you push button with code 0x10 you will first send G next send H next K and next again G etc...


Very good idea, probably the best solution for now... Looking forward to try it!
jhoexp
 
Posts: 7
Joined: 29 Dec 2013, 01:30
Location: Italy
Controller: DIY Mk1

Re: XHC WHB03 WHB04 mpg support

Postby whyucome » 12 Jan 2014, 16:03

hi moonglow, can u add display coor in a axis when switch to A asix for whb04? and can u make display to show absolute coor and work coor in same time (mc & wc)??thx yours great job
whyucome
 
Posts: 6
Joined: 07 Jun 2013, 17:31
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 13 Jan 2014, 07:39

2jhoexp
Ok, will update it on this week

2whyucome
Thanx, ok i will add this logic too like original Mach plugin do... it will output A axis to X axis value... about " absolute coor and work coor" Andrej API can't give it me... ;) BTW need to ask Andrej to make some extension to API 8-)
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 20 Jan 2014, 17:29

2jhoexp and whyucome
sorry for long delay, new update is ready, but i do not really test it
*WHB04 if wheel mode set to A you will get A axis values through X axis
+add hot keys conveyer for buttons, example:
Code: Select all
BTN:0x01:"LShift+A;LShift+N;LShift+C;1;a;X"
output was ( if you press BTN 0x01 8 times )
A N C 1 a x A N
and so on...
Attachments
xhc_beta_2.zip
beta 2, only EXE inside, use config from previus version
(15.08 KiB) Downloaded 513 times
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby whyucome » 22 Jan 2014, 07:00

thx Moonglow ,i will test it
whyucome
 
Posts: 6
Joined: 07 Jun 2013, 17:31
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby jhoexp » 24 Jan 2014, 22:05

Thank you Moonglow! I will test it tomorrow and report back! ;)
jhoexp
 
Posts: 7
Joined: 29 Dec 2013, 01:30
Location: Italy
Controller: DIY Mk1

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 29 Jan 2014, 09:13

open_xhc_logo_128x56.png
open_xhc_logo_128x56.png (8.93 KiB) Viewed 15923 times

btw just update my open source implemetation of XHC MPG hardware: HERE

main features:
* STM32F10x controller with hardware USB 2.0 FS
* Easy to remap most function I/O
* Rotary encoder ( quadrature output )
* Rotary switch ( 7 position )
* Switch button
* NOKIA 5110 LCD [PCD8544]
* EastRising ERC12864-4 COG LCD [ST7565R]
* 20×4 LCD [HD44780]
* Matrix keyboard ( up to 5×4 )
* Emulate L(W)HB04 and L(W)HB03 MPG
* Supports official plugins for Mach 3 and NCStudio
* Support for PlanetCNC
* Cheap BOM ~20$
* Mostly solderless!

Run's with 4 different type of displays:
hd44780_20x4-150x150.jpg
hd44780_20x4-150x150.jpg (8.95 KiB) Viewed 15834 times
st7735_tft-150x150.jpg
st7735_tft-150x150.jpg (10.45 KiB) Viewed 15834 times
nokia5110-150x150.jpg
nokia5110-150x150.jpg (9.04 KiB) Viewed 15834 times
erc12864_display-150x150.jpg
erc12864_display-150x150.jpg (8.29 KiB) Viewed 15834 times


so.. now we have custom software and hardware... totally owned 8-)
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 13 Feb 2014, 16:17

and now i want to make it looks nicer 8-)
top_side.JPG
top
top_side.JPG (153.96 KiB) Viewed 15672 times

torec_usb.JPG
corn
torec_usb.JPG (186.29 KiB) Viewed 15672 times
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby noobman » 02 Jun 2014, 23:04

Hi, I have WHB04 also, specifically this one http://www.cdxhctech.com/html/eProduct/view_130.html.

For the moment i dont have planet cnc software as i have a AKZ250 usb board which i think its not compatible (is it?). But i will consider planet-cnc software along with a controller (reccomandations? - sry offtopic). Anyway i just thought to post to check if the status of this development, so is the planet cnc software working with the WHB04 currently? I am asking coz i do not want to buy another pendant.
Thanks and cheers.
noobman
 
Posts: 2
Joined: 02 Jun 2014, 22:03
Controller: Other

Re: XHC WHB03 WHB04 mpg support

Postby Support » 04 Jun 2014, 08:13

AKZ250 usb board and Planet CNC software are not compatible.
WHB04 is not compatible with our controllers. I suggest you to contact user Moonglow, since he has been
working with this pendant and developing his own support. (I might be wrong)

We recommend Mk2/4, Mk2, or Mk3. And there will be a new official software release (which will be very soon).
Support
 
Posts: 2571
Joined: 07 Apr 2014, 17:39
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby Moonglow » 05 Jun 2014, 06:49

2noobman
Hi,
My software is dedicated tool and does not supported by PlanetCNC team ... so you can use it with PlanetCNC ( or other software ) but functionality is limited by PlanetCNC API. XHC BIND receive your input from XHC MPG and simulate keyboard strokes for buttons, feedback provided with PlanetCNC API ( current position, speed and so on ). Btw you can try it without PlanetCNC software at all...

p.s: another my project is hardware passthrough device what simulate mechanical MPG for XHC MPG but it under heavy development. if you have any question PM me.
Moonglow
 
Posts: 104
Joined: 11 Jan 2012, 04:45
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby azimahmed » 03 Feb 2015, 18:31

Hi Guys,

Can you please help me setup the HB04, I do have the setup and the dial is working with some buttons as well but the display is not changing.

Appreciate your help and support.

Thanx :D
azimahmed
 
Posts: 2
Joined: 31 Jan 2015, 16:21
Controller: Mk3

Re: XHC WHB03 WHB04 mpg support

Postby Support » 04 Feb 2015, 07:53

WHB04 is not compatible with our controllers. Please contact user "Moonglow" for this matter.
Thank you.
Support
 
Posts: 2571
Joined: 07 Apr 2014, 17:39
Controller: Many controllers

Re: XHC WHB03 WHB04 mpg support

Postby azimahmed » 18 Feb 2015, 19:15

Hello Moonglow,

I hope you are doing well, I have been trying to reach you on PM but unable to receive any reply :( .

Reference to your PM I have tried and there were some errors that i have mentioned to you, if you could help that will be great. :mrgreen: :mrgreen:

Thanks

Azim
azimahmed
 
Posts: 2
Joined: 31 Jan 2015, 16:21
Controller: Mk3

Next

Return to Accessories



Who is online

Users browsing this forum: No registered users and 1 guest