ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

Singapore
#49  

Thanks DJ! This is awesome. I've been holding off doing servo conversion of the meccanoid as my Daughter likes some of the simple features of the original 'meccabrain' (horrible name and just as bad design) such as motion capture and real time recording/playback of movements. I now plan on having the EZ-B and meccabrain switchable so the thing can please us both:)

I'm a little confused on the last part of the tutorial though. For the feet, do I just need the motor controller (it says it comes with leads for ez-b connection) that is listed in the diy products page, or will I need to perform the really really scary steps detailed in the video on the hbridge controller page (https://synthiam.com/Tutorials/Help.aspx?id=70) which includes chopping pins off and soldering bridges etc?

PRO
Synthiam
#50  

No soldering:)

The included wires replace the need to solder

Switzerland
#51  

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

PRO
Synthiam
#52  

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

Singapore
#53  

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.


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:


// 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:


//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:


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.

Singapore
#54  

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

 UartWriteBinary(0,0,&quot;Hello World&quot;) 

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.

Switzerland
#55  

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)

Singapore
#56  

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:) Thanks for your help.