Spinmaster Meccanoid Robot

 
#51

No soldering Smile

The included wires replace the need to solder

#52

Hi DJ, thanks a lot:-)

the resistors are used as part of the "smart?" communication feedback:

***********************
The bits of Smart Module data bytes are about 1.1ms long. Each byte has a start bit that is ~2ms LOW. There is no stop bit.
Unlike the bits from the MeccaBrain™ which are just HIGH and LOW for 1 and 0, the bits from the Smart Modules are based on high pulse widths. A “1” bit is when a High pulse is > 400ms; a “0” bit is when the High pulse is < 400ms.
**************************
as long as we just send, it seems to work without resistors as well

User-inserted image

#53

That helps! So it's two start bits.

The pull up is still a little unusual, as the mcu should rest high anyway. I'll update the tutorial with this info

#54

Hi @DJSures,

Thanks again for the tutorial on using the EZ-B to control the standard meccanoid servo's. It's taken me a while to get to it, but I now have all head and arm servo's working, and am able to change the servo color of each using the supplied instructions.

One thing I'm not clear of however, is how to control the meccanoid RGB eye color. These are a different format to the LED color commands.

In the arduino sketch supplied with the tutorial, the LED eyes are specified as being in servo position 2.2

Quote:

//Chain 1 - Left Arm. 1.0 is Arm Pitch, 1.1 is Arm Roll, 1.2 is Elbow
//Chain 2 - Head. 2.0 is Head Yaw, 2.1 is Head Roll, 2.2 is LEDs
//Chain 3 - Right Arm. 3.0 is Arm Pitch, 3.1 is Arm Roll 3.2 is Elbow



but the constant bytes defined underneath them skip the LED's entirely.

Code:


const byte LEFT_ARM_PITCH = 0;
const byte LEFT_ARM_ROLL = 1;
const byte LEFT_ARM_ELBOW = 2;
const byte HEAD_YAW = 3;
const byte HEAD_ROLL = 4;
const byte RIGHT_ARM_PITCH = 5;
const byte RIGHT_ARM_ROLL = 6;
const byte RIGHT_ARM_ELBOW = 7;



Furthermore, the setting of the eye color is different to the servo led's as defined in the sketch:-

For the servo LED's:

Code:


// set the servo color
// for example, setJointColor(RIGHT_ARM_ELBOW, JOINT_VIOLET)
void setJointColor(byte jointName, byte color)



aligns nicely with your example, but the eyes have RGB LED's which are set differently:

Code:


//Set the color of eye LEDS. red, green and blue are from 0 to 7 (0 - no color, 7 - max color).
//fadetime is from 0 to 7 and means the speed of color change (0 - immediate change, 7 - longest change)
//example: setColor(7,0,0,3) means change color to red with average speed
void setEyesColor(byte red, byte green, byte blue, byte fadetime)



Consequently I'm unsure how to send a command from the EZ-B to the RGB eyes to set their color. Would I need to do something like:

Code:


UARTInit(0, 0, 9600)

definearray($mecaSend, 5)

$mecaSend[0] = 0x02 # set RGB Eye Color
$mecaSend[1] = 0x00 # Value for R
$mecaSend[2] = 0x00 # Value for G
$mecaSend[3] = 0x00 # Value for B
$mecaSend[4] = 0x09 # Fadetime

UARTWriteBinary(0, 0, $mecaSend)



having defined 0x02 somewhere in the arduino sketch?

Any advice would be appreciated. Thanks.

#55

From looking at some if the forum posts around UART, it appears to me that you can use them for regular serial communication as well as bit-wise operations, is that correct?

I saw one example (but can't seem to find it again) where I saw something like

Code:

 UartWriteBinary(0,0,"Hello World") 

but I'm clearly clueless with Uart comms *stress* so would appreciate some assistance. The tutorial addresses everything else (servo's, servo led's, feet motors), but makes no mention of The Eye RGB led's.

#56

Hi Aceboss,
open the example files in the cloud and search for "Meccano MeccaNoid"
it is an incomplete project, but has the eye colour change in (without fading)

#57

Thank you Jetpilot, that helped put me on the right track.

There's a couple of bits of your logic I don't quite understand (for instance the use of shift byte right) in your ez-script, however I've managed to get the eyes working with fade by sending 5 bytes (the 5th being a fade duration).

For some reason it doesn't work if I only do a UARTWriteBinary once, but if I loop the sending section then it works.

Also not sure why the switch case in the arduino script won't trigger if I add a case 2: but does if I use an if (cmd ==2) statement, but since that's arduino code specific probably not relevant in this thread.

Anyhow, maybe not the optimum solution but it's working now Smile Thanks for your help.

#58

I made a quick cable and connected an arduino to my Meccanoid servo's using tutorial and then connected EZB to arduino via UART. I wrote a quick script from samples and worked very well (THANKS FOR WRITING THIS UP).

Has anyone written a script to read current server position. (Disable Servo, Manually move, read servo position).

Thanks.

#59

Quote:

Has anyone written a script to read current server position. (Disable Servo, Manually move, read servo position).


@Nink Hobby servos like EZ Robot HDD type (as opposed to Dynamixel type) have no ability for feedback... aka position feedback... However you can hack a hobby servos to read the servos internal potentiometer by soldering a 4th wire to the wiper pin of the internal pot... You connect that wire to the ezb4's analog port which will give a relative servo position...

#60

Hi @Richard_R The Meccanoid Servo's may be junk and no torque but they did one thing right, they have a potentiometer in them so they have the ability to report servo position. You can put the meccanoid in LIM mode and then record a series of movents by manually moving arms head etc. Meccanoid records the movements and plays them back. The Arduino Firmware appears to support it if you read the meccabrain.cpp file but the sample code on the arduino that interfaces with the EZB does not appear to support it.