I have an Arduino Duemilanove (with ATMega328P), and I also have an I2C device to interface with, the MD25 motor controller from Devantech.
On the Devantech's page though i can't seem to find an Arduino example for the MD25...
Can someone help me with this ?
Example of how to connect and also the sketch to control it:
http://www.robot-electronics.co.uk/htm/arduino_examples.htm#MD23 RD01 Motor Controller
You are welcome :)
thank you for your quick reply.
I used the example you are referring to, but it doesn't work.
After wiring as the scheme shows and uploading the sketch there is no connection between arduino and the MD25. It doesn't even read the software version. That's why I thought I should use another sketch since this one is for the MD23. For example: the address for the MD23 in the sketch is "#define md23Address 0x58 // Address of the MD22", and in the tech specs it says the MD25 is shipped with the default address 0xB0.
There is an inconsistancy in the information.
Should MD25 work with the MD23 sketch ?
Then change the address to 0xB0. The code should work, it looks pretty straightforward use of the Wire library.
Basically, when you call this sequence
a command is send over I2C to the device.
Try different commands, according to the datasheet, something must happen.
I'm also new to Arduino & having trouble interface with MD25.
As what I understand;
Wire.beginTransmission(0xB0); //initiate address of MD25
Wire.send(speed2); //speed2 means Motor2 speed (mode 0,1)
Wire.send(x); //can you explain why 'x'??
Just one silly question :). What does 'x' means in Wire.send(x)?
What does 'x' means in Wire.send(x)?
Just a dumb-ass guess, but I suspect this is setting the speed to the value stored in x. Somewhere prior to this code, you would need to define x, and assign it a value.
Yup, ‘x’ must be declare earlier in the code. Sorry, I’m new to programming…
Anyway, I just want to test my Arduino Mega & interface it with MD25 to control my robot. For a start, I only want Arduino to talk with MD25 ie; asking for Battery volts. I guess this will be the simplest i2c code for testing. So, this is my code;
int batt = 0;
batt |= Wire.receive();
However, only zero value ‘0’ on Serial Monitor. Help me please
I have no idea if that is the proper data to send to get the information that you want. But, this looks unusual to me:
batt |= Wire.receive();
What are [u]you[/u] expecting this to do?
batt = Wire.receive();
but the output is still the same. I get confuse with several i2c command especially Wire.requestForm() and Wire.available()
My main reference is Arduino example SFRRanger_reader.
just want to check my wiring
SDA on arduino connect to SDA on MD25
SCL on arduino connect to SCL on MD25
GND to GND
Vcc on MD25 leave not conneted.
MD25 supplied voltage is 12V (from battery)
Am I right?