SMC02B control using arduino?

Hi,

I would like to use the smc02b motor controller with a pair of motors in arduino but I am finding it hard to translate the examples in the user guide. Could someone please point me in the right direction of a tutorial? Or give me a list of serial commands I can try with arduino?

Thanks in advance,

Stuart

Hello.

You probably have a Micro Dual Serial Motor Controller; if you do a search for that and Arduino, there are various results. I saw some examples for our newer qik motor controllers, and the only difference is in what bytes you are sending. It sounds like you mostly don’t know how to send serial data on the Arduino, in which case any tutorial about that should help; if you have questions about which specific bytes to send, you can post a more specific question about what is confusing you.

- Jan

Hi Jan,

I put the type of controller in my post. What I want is to see an example of the commands I need to send via the serial port. In the manual they are all chopped into sections explaining what each part does and I cannot understand the pic example.

Could you please send me example commands for forward for ten seconds, backward for ten seconds, left for 10 seconds, right for 10 seconds. Then I can see what is what and send these commands via my microcontroller to test.

Thanks,

Stuart

I don’t have an example program like that to give you. I’m not sure what to make of your “I put the type of controller in my post” comment; it sounds like you’re going out of your way not to confirm what you have. Did you look around using the actual name of the product, as I suggested? By the way, our dual serial motor controllers generally control two independent motors with similar commands for each motor (you just change which motor a command is for), so notions like “left for 10 seconds” would only apply to specific robot or mechanical arrangements.

- Jan

Hi Jan,

I have a Micro Dual Serial Motor Controller which has the item code SMC02B!!!

I know that by turning one motor on and the other off it will make the robot go left. I understand the logic behind it all. I just cannot communicate with the motor controller and make it happen which is causing me to get frustrated.

This is why I asked for some sample commands. Perhaps you could you supply them for the following scenarios.

Both motors forward
Both motors backward
Motor A forward, Motor B backward
Motor B forward, Motor A backward

I would be extremelly grateful if you could help me with this,

Stuart

Regarding the SMC02B string, the point is that is not the name of the product or even its part number, so searches for information and sample projects are more likely to be successful if you use the actual name of the product (rather than some identifier on the back of a PCB that’s too small to fit much else).

The two motors outputs are controlled independently, so if you want to achieve the combinations you listed, you just have to send two separate commands to the two motors one after the other. Every single command is going to start with 0x80 (decimal 128) and 0, so you just have to change the last two bytes. The third byte is motor and direction, and the fourth is speed. If you just want some movement for now, you can use 0 and 0x7F (decimal 127) for the fourth byte to switch between stop and full speed. This leaves the third byte, which I suspect is what is causing you problems.

You can use just motor numbers 0 and 1 for the two motors, which means that the upper 6 bits of byte three will always be 0, and the only four possible values are

0 for motor 0 reverse
1 for motor 0 forward
2 for motor 1 reverse
3 for motor 1 forward

Putting this together, sending 0x80, 0, 0, 127 will make motor 0 go in reverse at full speed. It will keep going at that speed until you send a different command for that motor, so if you then send 0x80, 0, 3, 127, you will make the other motor go forward at full speed. Sending 0x80, 0, 1, 127, followed by 0x80, 0, 2, 127, would make both motors switch directions. (In practice, you should stop both motors for a bit first, by sending 0x80, 0, 0, 0 and 0x80, 0, 2, 0, before changing directions.)

- Jan