Thumbnail

UBTECH Alpha Servos UBT-12HC

Control the UBTECH Alpha Robot Digital Servos (UBT-12HC) with EZ-Builder

+ How To Add This Control To Your Project (Click to Expand)
  1. Make sure you have the latest version of ARC installed.
  2. Select the Get button in this page to download the archive file.
  3. Double click the downloaded archive file to execute installer.
  4. The installer will add this control to ARC.
  5. Load ARC and press the Project -> Add Control button from the menu.
  6. Choose the Servo category tab.
  7. Press the UBTECH Alpha Servos UBT-12HC icon to add the control to your project.

Manual

Control the UBTECH Alpha Robot Digital Servos (UBT-12HC) with EZ-Builder. The servos must be powered appropriately, and connected to the EZ-B v4 or IoTiny with the respective port. Visit the Config menu of this plugin to view the port configuration.

The Virtual Ports (V0..V99) in EZ-Builder can be assigned to the UbTech servos.

UART Ports
- This plugin requires the RX signal wire of the servo be connected to TX of the selected UART or digital port (if Software UART is selected on IoTiny)

- Hardware UART is for the EZ-B v4 only. Do not use software UART on EZ-B v4. View the EZ-B v4 datasheet to identify the UART ports (0, 1, or 2). EZ-B v4 datasheet can be found here: http://www.ez-robot.com/Tutorials/Lesson/18

- Software UART should only be used with IoTiny

- Default baudrate of UBTECH servos is 115,200

Bind To Virtual Servos
- The configuration menu also provides an option to select the Virtual Ports, which correspond with the ID's of the UBTech servos. If the UBTECH servo ID #0 is connected, select V0. #1 = V1, #2 = V2, etc..

Additional Info
- Discussion on these servos is here: https://synthiam.com/Question/3932


User-inserted image



Custom Bit Settings
There are 3 bits that seem to not be understood for the protocol. Since UBTech does not release the protocol for their products, the community is working to better understand what the parameters are. The configuration menu of this plugin allows you to set hardcoded values for those bits. The bits are for 5, 6 & 7.

Custom servo Position Mapping
The UB Tech servos have their own position range, and we don't know what it is. So, the configuration menu allows you to specify the min and max positions for the range. This will be mapped to the ARC servo position range. Meaning, if you set the range in this plugin, it will be mapped to the range for all ARC servo controls.

Protocol Packet Code
Here's a copy and paste from the plugin code. This is how the packet is being assembled to be sent to each servo. The values specified by you in the configuration menu are b5, b6, b7, mapLow and mapHigh.

User-inserted image

#111  

Quote:

Yes, i use win7. I know it's not recommended,
It's OK I still use windows 7. I post Windows 10 start menu screenshot, and you asked what kind of application... so I guessed you are not familiar with Windows 10.

Quote:

Your suggestions didn't help. Connecting fails. I see in the debug area : name is valid, but requested data were not found . disconnected.
Can you take a screen snip ? It's a simple tool, I can't figure out your issue.
#112   — Edited

Quote:

Dj and I guess that there may be a timing concern, i.e. the transition time must be coherent with the parameter "running time" that's in the message.
I'll stop insisting it seems I'm hitting a wall, there is no public protocol for the servos.
I don't own the toy and I did the comments based on the existing information.
IF you or DJ have more information please share otherwise I think we are talking different things.

I'll summarize the relevant parts:

1)
https://alexsonea.com/2017/10/15/jimu-hacking-the-communication-protocol/
this is relevant part:

Quote:

For the time being here is a summary of the finds:

the communication is at 115,200bps
packages are send separately by servo; it doesn’t seem to be a bulk send instruction
the package has the following structure:
byte 1 and 2 = preamble = 0xFA 0xAF
byte 3 = servo ID
byte 4 = Command; for go to command we have = 0x01; we will try to find some other commands shortly
byte 5 8 = Command parameters; for command = 0x01 (go to) they are:
byte 5 = position = 120 + desired position in degrees
byte 6 = duration = duration in ms / 20
byte 7 = 0x00 (? we don’t know what this is yet)
byte 8 = 0x01 (? we don’t know what this is yet)

byte 9 = checksum = sum(byte 3 through 8) mod 256byte 7 = 0x00 (? we don’t know what this is yet)
byte 10 = closure = 0xED (from END?)
based on the above information there is no parameter "running time", maybe you based your guess on the bluetooth protocol, but, if the things don't work don't blame the UBTECH.

2)
https://alexsonea.com/2017/10/24/jimu-hacking-the-communication-protocol-2/
https://videos.files.wordpress.com/BkEIYNwW/pgz3tqwos4279eeqz27xda_dvd.mp4

Code:

go0 = bytearray.fromhex("FAAF05017814000193ED")
go45 = bytearray.fromhex("FAAF0501A5140001C0ED")
go90 = bytearray.fromhex("FAAF0501D2140001EDED")
Based on the above information from the same source:
0       = 79 hex = 120 dec
+45  = A5 hex = 165 dec
+90  = D2 hex = 210 dec

Switching to EZ-Builder's plugin: 

EZ-script to move the servos to the left 0, 45, 90, and right 0, -45, -90:

Code:

#EZ-Builder servo degrees range are: 1-180, middle point 90
#UBTECH servo degrees theoretically range are: -120 to +120, middle point: 0
#rotate left
servo(V5, 90)
servo(V5, (90+45))
servo(V5, (90+90))

#rotate right
servo(V5, 90)
servo(V5, (90-45))
servo(V5, (90-89))
EZB serial output:
User-inserted image


Quote:

byte 7 = 0x00 (? we don’t know what this is yet)
byte 8 = 0x01 (? we don’t know what this is yet)
byte #8:
I don't know why 10 is being sent when the safe (known) value is 01, without any other info I would stick with 1 to avoid unpredictable results.

byte #4 blue is the position and i believe the value is wrong:
for 3 positions tested in the video should be 120, 165, 210 and  the plugin is sending 119 (close), 179, 240

If I'm wrong please provide more information.
#113   — Edited
I must be blind ! I wrote  127.0.0.1.23   instead of  127.0.0.1:23  !...Now  the emulator works.  I can read the famous 160 bytes (i had guessed 170), I had seen  with the oscilloscope,
The messages are quite different from the bluetooth ones. I can't get any  inspiration from them. I'll change my mind.
I'll go on experimenting with the  incomplete protocol from Australian member Nicky777,  trying to make it work correctly with ezb. 
Thanks to PTP for his great help.
#114  
@PTP.
About your post 112

Quote:

based on the above information there is no parameter "running time", maybe you based your guess on the bluetooth protocol, but, if the things don't work don't blame the UBTECH.
You're right. 

Quote:

https://videos.files.wordpress.com/BkEIYNwW/pgz3tqwos4279eeqz27xda_dvd.mp4
This video shows a Jimu's servo, that appears to be quite different from alpha 1s ones. Related considerations about movement range probably don't apply to alpha's servos.

Quote:

Switching to EZ-Builder's plugin:

EZ-script to move the servos to the left 0, 45, 90, and right 0, -45, -90:
Code:
#EZ-Builder servo degrees range are: 1-180, middle point 90
#UBTECH servo degrees theoretically range are: -120 to +120, middle point: 0
#rotate left
servo(V5, 90)
servo(V5, (90+45))
servo(V5, (90+90))

#rotate right
servo(V5, 90)
servo(V5, (90-45))
servo(V5, (90-89))
I'm probably the unique member  who actually tested the plug-in  in an  alpha robot.
This script stalls the servo when 140 is exceded. Actual range is :  1=-90,70=center, 140=+90

Quote:

byte #8:
I don't know why 10 is being sent when the safe (known) value is 01, without any other info I would stick with 1 to avoid unpredictable results.
So do I. I'll try with 1. ( the checksum needs  to be modified accordingly)

Quote:

byte #4 blue is the position and i believe the value is wrong:
for 3 positions tested in the video should be 120, 165, 210 and the plugin is sending 119 (close), 179, 240

If I'm wrong please provide more information.
I think these values don't apply to alpha's servos.
Synthiam
#115   — Edited
This plugin has a change to allow the bits 5, 6 & 7 to be hardcode set in the config menu. Remember, byte positions start at 0, not 1. So when you discuss byte #8, you're really discussing byte #7.

You can also specify the servo range as well.

I no longer need to be involved in this plugin. All of the settings and configuration are available to you in the plugin.:) Have fun
#116  
I'm happy to see you went on working....
i'll test the new plug in.