Connecting Position Controller (Item code 27971) with aduino uno. Please help...
Vovik
Posts: 4
I have difficulty to connect the Motor Mount and Wheel Kit with Position Controller ( http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/hb-25/List/0/SortField/4/ProductID/507/Default.aspx ) with arduino.
As well I have the position controller connected to HB-25 Motor Controller (http://www.parallax.com/Store/Accessories/MotorServos/tabid/163/txtSearch/hb-25/List/0/SortField/4/ProductID/64/Default.aspx) but this part works fine as I tested it by just sending PWM directly to HB-25 and it behave as expected.
Here it is how I wired it:
=================
Position Arduino
Controller
DATA
> Digital pin 3
+5
> +5
GND
> GND
Here it is my arduino test code:
======================
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup()
{
// set the data rate for the SoftwareSerial port
mySerial.begin(19200);
}
void loop() // run over and over
{
mySerial.write(0x28);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
mySerial.write(0x20);
delay(50); // do not know if i need this delay?
mySerial.write(0x01);
delay(50); // do not know if i need this delay?
mySerial.write(0x01);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
mySerial.write(0x28);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
}
What I expected when I power or reset arduino is wheels to stay steel for a 4 second then rotates for no more then 4 seconds then stop for 4+4 seconds.... But what I observe is the wheel rotates continously for around 6-8 seconds and then starts and stops sporadically...
Even worse when i power the whole thing down and up it does not repeat the pattern of behavior... does not act consistent.
Couls somebody please advice me how to connect the position controller to arduino onu?
Thanks.
VG.
As well I have the position controller connected to HB-25 Motor Controller (http://www.parallax.com/Store/Accessories/MotorServos/tabid/163/txtSearch/hb-25/List/0/SortField/4/ProductID/64/Default.aspx) but this part works fine as I tested it by just sending PWM directly to HB-25 and it behave as expected.
Here it is how I wired it:
=================
Position Arduino
Controller
DATA
> Digital pin 3
+5
> +5
GND
> GND
Here it is my arduino test code:
======================
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup()
{
// set the data rate for the SoftwareSerial port
mySerial.begin(19200);
}
void loop() // run over and over
{
mySerial.write(0x28);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
mySerial.write(0x20);
delay(50); // do not know if i need this delay?
mySerial.write(0x01);
delay(50); // do not know if i need this delay?
mySerial.write(0x01);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
mySerial.write(0x28);
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
delay(1000); // Wait for 1 seconds
}
What I expected when I power or reset arduino is wheels to stay steel for a 4 second then rotates for no more then 4 seconds then stop for 4+4 seconds.... But what I observe is the wheel rotates continously for around 6-8 seconds and then starts and stops sporadically...
Even worse when i power the whole thing down and up it does not repeat the pattern of behavior... does not act consistent.
Couls somebody please advice me how to connect the position controller to arduino onu?
Thanks.
VG.
Comments
As for connecting, what you have will work for simplex communication, and is sufficient for getting started. If you want 2-way communication, you'll need to "steer" the 1-wire UART as shown in post #4 here:
http://forums.parallax.com/showthread.php?120828-help-colorpal-sensor&p=890024#post890024
Forget that the labels show some other Atmel chip and the ColorPal -- the general idea is the same for interfacing the Arduino to any of Parallax's 1-wire UART products.
-- Gordon