Hi,
I’m thinking about getting the Arduino Mega. I was wondering if anyone knows what Vex components work or don’t work with the arduino. I’m getting the arduino so I can learn more about circuits and application for microcontrollers besides on robots.
I have:
Motors/servos (should work. 5v. and PWM outputs)
Bumpers/limit switches (surely these work lol)
Ultrasonic rangefinder
3 axis accelerometer
line trackers
quadrature optical shaft encoders
I think almost all work. I have an arduino uno and I haven’t found something that I cant use. I know the motors work because arduinos can control PWM cables, and give out 5v depending on you input voltage. Yeah bumpers and limits work fine, and i know for sure the ultrasonic rangefinder, and accelerometer work. Id’e assume pretty much everything else would though, Vex makes pretty universal/standard equipment. If you find something that doesn’t work, id’e be shocked.
Agreed. Vex accessories should be pretty much plug-compatible with Arduino. To make it even easier, you could get this shield, but build it with female headers instead of the male ones provided. Then you could literally plug Vex accessories right in.
The 4-pin I2C port is almost Vex-compatible; the Clock and Data pins (3&4) are swapped. So close - even the right gender!
Arduino’s are hot here too. I have the board that Dean linked to and I built it with the female connectors to make it easier. As an aside, I also put the “stacking headers” on everything I build, so I can stack anything.
We’ve done some work using the thumb joysticks on an Uno with an Xbee talking to the the Mega with an Xbee to allow remote driver control. This IO board has motor control and XBee support DF Robot IO V 5
As far as sensors go there is a huge array of sensors that work, past the VEX ones. I’m a big fan of the IR sensors, sadly VEX hasn’t put any out. So we use the Sharp ones from Sparkfun or Roboddsey.
The wiring language (like Processing) is easy and the prewritten libraries are very impressive. I used the Uno in my networking class as a basis for the Webserver examples. I have an Ethernet shield with an SD card, and it took about 1/2 hour to get it running with the code examples.
Steve is working on Ardunio control with VEX frames for the PSU firefight contest. I’m working on a multi Arduino environment (one Mega with the 2 serial ports out to Uno’s for sensors, one serial to the Serial PWM board and the fourth Serial to XBee for communications. The XBee will allow the joysticks to talk and then a side monitor channel for PC remote monitor.
This book on Making Things Talk is very impressive. It covers a ton of interface information and is a go-to document if you are going to use XBee.
Cody, I’d go for the Mega board out of the gate, the extra pins and serial’s will help you. The standard shields fit on the Mega to get some of the IO/breakouts done for you.
Thanks so much for the help! I really appreciate it. I’m ordering it today! This might sound a little crazy, but what’s an Xbee? Is it a bluetooth or wireless connection? I might look into it.
Yeah, I would go with the mega, Cody. It has tons of extra digital inputs/outputs and 14 pwm. I wish I could order custom parts, but unfortunately, I don’t have a good CAD, nor the money to order parts. But Vex is fine!
That looks like a great shield, but my kit came with a breadboard, so I’ll probably use that (as long as the wiring doesn’t get too hectic)
Yes I do. With the Arduino there is a ton of open source hardware and software. At this point you should make Google your friend. Start with Googling arduino hobby servo You’ll get about 46,000 responses. The VEX servos work just like the hobby ones, except the pins are male instead of female.
I tried the arduino forum. Man, you get a response instantaneously there. I googled for some examples too. Thanks for the advice
Anyways, for anyone that wants to know, type
#include <Servo.h>
before your code. Then set up the servo.
Servo motor;
I used motor, but you can call it anything you want. Then in the setup function, put
motor.attach(22);
. 22 is the digital port I used, motor is the name of my servo. Then, to write to the servo type
motor.write(value);
. Value is my variable that I use to control the motor, but you can type in a number from 0 to 179 (I think) and, of course, motor is the name of the servo.
My complete code:
//Drive a servo
#include <Servo.h> //includes servo library
#define Button1 3 //assigns the port my buttons are pressed into
#define Button2 4
#define Button3 2
Servo motor; //creates a servo object called "motor"
int value = 90; //starts my variable at 90 so the motor
int buttoni = 0; //won't move or the servo will be in center
int buttonii = 0; //position.
int buttoniii = 0; //These just set variables for the buttons
void setup()
{
motor.attach(22); //Motor connected to digital port 22
pinMode(Button1, INPUT); //make these buttons inputs
pinMode(Button2, INPUT);
pinMode(Button3, INPUT);
digitalWrite(Button1, HIGH); //Uses built in pull-up resistor.
digitalWrite(Button2, HIGH);
digitalWrite(Button3, HIGH);
}
void loop()
{
motor.write(value); //send directions to the motor
buttoni = digitalRead(Button1); //reads the buttons
buttonii = digitalRead(Button2);
buttoniii = digitalRead(Button3);
if (buttoni == LOW) //if the first button
{ //is pressed then
value = 179; //make the motor go clockwise
}
if (buttonii == LOW) //if second button pressed
{ //make motor go counter-clockwise
value = 0;
}
if (buttoniii == LOW) //if third button pressed
{ //make motor stop
value = 90;
}
}
Just wanted to share for people searching for this.
uC’s are pretty cool, but I prefer just building circuits out of ICs I have laying around. It seems more satisfying to build a circuit by looking at a data sheet and have it work just the way you want it to. For anyone who’s interested, this soundcard oscillascope http://www.zeitnitz.de/Christian/scope_en is great for debugging stuff. I thought I’d just throw that out there…