Electric Vehicle C

Justin Zhang
Member
Member
Posts: 4
Joined: September 9th, 2016, 3:35 pm
Division: C
State: MI
Contact:

Re: Electric Vehicle C

Postby Justin Zhang » April 2nd, 2017, 7:54 am

I have tried a EV design using an Arduino and VEX Quadrature Encoder. The problem was the Arduino could not count the rotations of the encoder fast enough, so when reaching high speeds it skipped rotations and decreased the distance it ran. Different types of programs (on Arduino IDE of course) affected the accuracy, so it seems to depend on how fast the program is. I've considered interrupts, libraries, etc.
I understand that many people use Arduinos for their EV. How do you guys run them to the correct accuracy?

Secondly, my arduino mega reads encoders in degrees of 90 when I need accuracy up to 360.

Please share some sample code?

User avatar
windu34
Moderator
Moderator
Posts: 1207
Joined: April 19th, 2015, 6:37 pm
Division: Grad
State: FL
Location: Gainesville, Florida
Contact:

Re: Electric Vehicle C

Postby windu34 » April 2nd, 2017, 8:11 am

Justin Zhang wrote:I have tried a EV design using an Arduino and VEX Quadrature Encoder. The problem was the Arduino could not count the rotations of the encoder fast enough, so when reaching high speeds it skipped rotations and decreased the distance it ran. Different types of programs (on Arduino IDE of course) affected the accuracy, so it seems to depend on how fast the program is. I've considered interrupts, libraries, etc.
I understand that many people use Arduinos for their EV. How do you guys run them to the correct accuracy?

Secondly, my arduino mega reads encoders in degrees of 90 when I need accuracy up to 360.

Please share some sample code?

From the sound of it, you are not utilizing the complete effects of the quadrature reading capabilities. Make sure the code you are using is meant for quadrature readings. Additionally, you must use interrupts if you want to read any encoder with a resolution higher than 8 bits. Ensure you have no prints or reads to the serial monitor, which are often a reason to the Arduino not reading the encoder properly
President of Science Olympiad at the University of Florida || Boca Raton Community High School Alumni
kevin@floridascienceolympiad.org
windu34's Userpage

Event Supervisor for 2019:
MIT Invitational - Mission Possible
Harvard Invitational - Sounds of Music
Princeton Invitational - Herpetology

cubes
Member
Member
Posts: 8
Joined: March 26th, 2017, 7:58 pm
Division: C
State: NC
Contact:

Re: Electric Vehicle C

Postby cubes » April 2nd, 2017, 8:43 am

If I choose to do a fixed angle for the steering, would the EV travel in a circular path and does the radius stay constant regardless of velocity and acceleration?

thesenotes
Member
Member
Posts: 17
Joined: April 1st, 2017, 3:27 pm
Division: C
State: NY
Contact:

Re: Electric Vehicle C

Postby thesenotes » April 2nd, 2017, 9:52 am

cubes wrote:If I choose to do a fixed angle for the steering, would the EV travel in a circular path and does the radius stay constant regardless of velocity and acceleration?


The radius will stay constant as long you aren't accelerating so fast that it causes slipping in the wheels and changes the direction of your EV. There is a limit to the maximum velocity your car can go around a curve until it begins to skid laterally, but I have had no problem achieving a 3 second time without that issue.
2016 SONT: 5th Place Scrambler
2017 MIT: 1st Place Electric Vehicle
2018 MIT: 1st Place Helicopter, 6th Place Mousetrap Vehicle
2018 UPenn: 2nd Place Mousetrap Vehicle, 2nd Place Mission Possible, 3rd Place Helicopter

pkhsekar@gmail.com

thesenotes
Member
Member
Posts: 17
Joined: April 1st, 2017, 3:27 pm
Division: C
State: NY
Contact:

Re: Electric Vehicle C

Postby thesenotes » April 2nd, 2017, 10:11 am

Justin Zhang wrote:I have tried a EV design using an Arduino and VEX Quadrature Encoder. The problem was the Arduino could not count the rotations of the encoder fast enough, so when reaching high speeds it skipped rotations and decreased the distance it ran. Different types of programs (on Arduino IDE of course) affected the accuracy, so it seems to depend on how fast the program is. I've considered interrupts, libraries, etc.
I understand that many people use Arduinos for their EV. How do you guys run them to the correct accuracy?

Secondly, my arduino mega reads encoders in degrees of 90 when I need accuracy up to 360.

Please share some sample code?


Here is some code. Each white wire on the VEX encoder should be connected to pins 2 and 3 on the Arduino (these are the interrupt pins) and the black and red wires should be connected to ground and a power supply of 5V, respectively:

// Red - 5V
// Black - GND
const int encoder_a = 2; // use one white wire here
const int encoder_b = 3; // use the other white wire here
long encoder = 0;

void setup() {
Serial.begin(9600);
pinMode(encoder_a, INPUT_PULLUP);
pinMode(encoder_b, INPUT_PULLUP);

attachInterrupt(0, encoderPinChangeA, CHANGE);
attachInterrupt(1, encoderPinChangeB, CHANGE);
}

void loop() {
Serial.println(encoder);
}

void encoderPinChangeA() {
encoder += digitalRead(encoder_a) == digitalRead(encoder_b) ? -1 : 1;
}

void encoderPinChangeB() {
encoder += digitalRead(encoder_a) != digitalRead(encoder_b) ? -1 : 1;
}
2016 SONT: 5th Place Scrambler
2017 MIT: 1st Place Electric Vehicle
2018 MIT: 1st Place Helicopter, 6th Place Mousetrap Vehicle
2018 UPenn: 2nd Place Mousetrap Vehicle, 2nd Place Mission Possible, 3rd Place Helicopter

pkhsekar@gmail.com

User avatar
windu34
Moderator
Moderator
Posts: 1207
Joined: April 19th, 2015, 6:37 pm
Division: Grad
State: FL
Location: Gainesville, Florida
Contact:

Re: Electric Vehicle C

Postby windu34 » April 2nd, 2017, 12:08 pm

thesenotes wrote:
Justin Zhang wrote:I have tried a EV design using an Arduino and VEX Quadrature Encoder. The problem was the Arduino could not count the rotations of the encoder fast enough, so when reaching high speeds it skipped rotations and decreased the distance it ran. Different types of programs (on Arduino IDE of course) affected the accuracy, so it seems to depend on how fast the program is. I've considered interrupts, libraries, etc.
I understand that many people use Arduinos for their EV. How do you guys run them to the correct accuracy?

Secondly, my arduino mega reads encoders in degrees of 90 when I need accuracy up to 360.

Please share some sample code?


Here is some code. Each white wire on the VEX encoder should be connected to pins 2 and 3 on the Arduino (these are the interrupt pins) and the black and red wires should be connected to ground and a power supply of 5V, respectively:

// Red - 5V
// Black - GND
const int encoder_a = 2; // use one white wire here
const int encoder_b = 3; // use the other white wire here
long encoder = 0;

void setup() {
Serial.begin(9600);
pinMode(encoder_a, INPUT_PULLUP);
pinMode(encoder_b, INPUT_PULLUP);

attachInterrupt(0, encoderPinChangeA, CHANGE);
attachInterrupt(1, encoderPinChangeB, CHANGE);
}

void loop() {
Serial.println(encoder);
}

void encoderPinChangeA() {
encoder += digitalRead(encoder_a) == digitalRead(encoder_b) ? -1 : 1;
}

void encoderPinChangeB() {
encoder += digitalRead(encoder_a) != digitalRead(encoder_b) ? -1 : 1;
}

If this still fails to track every encoder movement, consider using bitmath and direct port reads and writes to increase processing speed
President of Science Olympiad at the University of Florida || Boca Raton Community High School Alumni
kevin@floridascienceolympiad.org
windu34's Userpage

Event Supervisor for 2019:
MIT Invitational - Mission Possible
Harvard Invitational - Sounds of Music
Princeton Invitational - Herpetology

NilaiVemula
Member
Member
Posts: 32
Joined: March 26th, 2017, 5:39 pm
Division: C
State: TN
Contact:

Re: Electric Vehicle C

Postby NilaiVemula » May 2nd, 2017, 4:28 pm

Does anyone have any effective methods of attaching a caliper to the side of your vehicle?
White Station High School
2018: (Invitationals/Regionals/State/Nationals)
Hovercraft: (3/1/-/-)
Thermodynamics: (3/1/-/-)
Mission Possible: (4/2/-/-)
Remote Sensing: (1/1/-/-)
Microbe Mission: (1/1/-/-)
Dynamic Planet: (1/1/-/-)

User avatar
Bazinga+
Exalted Member
Exalted Member
Posts: 383
Joined: March 8th, 2014, 7:10 am
Division: C
State: NY
Location: Ward Melville HD
Contact:

Re: Electric Vehicle C

Postby Bazinga+ » May 2nd, 2017, 6:22 pm

NilaiVemula wrote:Does anyone have any effective methods of attaching a caliper to the side of your vehicle?

I clipped mine by having 2 pieces of metal sticking up from the side of the vehicle and then clamping it by using 2 screws and bolts for each to tighten another piece of metal over the caliper. This way the caliper was squeezed between the screwed on piece of metal and the one attached to the side of the vehicle in two places (for stability). Additionally i put some thin soft rubber material between the caliper and the metal that clipped it which helped secure it well.
Innovation =/= success

User avatar
windu34
Moderator
Moderator
Posts: 1207
Joined: April 19th, 2015, 6:37 pm
Division: Grad
State: FL
Location: Gainesville, Florida
Contact:

Re: Electric Vehicle C

Postby windu34 » May 3rd, 2017, 8:03 pm

Any suggestions for regulating my power supply to my brushless ESC? I tried using a buck converter rated for 8A (12A max) with the voltage set at 7V, but I think the sudden load fluctuation caused the converter to break because now I can no longer adjust the output voltage to any other quantity than the input voltage
President of Science Olympiad at the University of Florida || Boca Raton Community High School Alumni
kevin@floridascienceolympiad.org
windu34's Userpage

Event Supervisor for 2019:
MIT Invitational - Mission Possible
Harvard Invitational - Sounds of Music
Princeton Invitational - Herpetology

NilaiVemula
Member
Member
Posts: 32
Joined: March 26th, 2017, 5:39 pm
Division: C
State: TN
Contact:

Re: Electric Vehicle C

Postby NilaiVemula » May 4th, 2017, 3:58 pm

Bazinga+ wrote:
NilaiVemula wrote:Does anyone have any effective methods of attaching a caliper to the side of your vehicle?

I clipped mine by having 2 pieces of metal sticking up from the side of the vehicle and then clamping it by using 2 screws and bolts for each to tighten another piece of metal over the caliper. This way the caliper was squeezed between the screwed on piece of metal and the one attached to the side of the vehicle in two places (for stability). Additionally i put some thin soft rubber material between the caliper and the metal that clipped it which helped secure it well.


Thanks
White Station High School
2018: (Invitationals/Regionals/State/Nationals)
Hovercraft: (3/1/-/-)
Thermodynamics: (3/1/-/-)
Mission Possible: (4/2/-/-)
Remote Sensing: (1/1/-/-)
Microbe Mission: (1/1/-/-)
Dynamic Planet: (1/1/-/-)

User avatar
dcrxcode
Exalted Member
Exalted Member
Posts: 123
Joined: March 22nd, 2015, 8:53 am
Division: Grad
State: IN
Contact:

Re: Electric Vehicle C

Postby dcrxcode » May 7th, 2017, 10:55 am

windu34 wrote:Any suggestions for regulating my power supply to my brushless ESC? I tried using a buck converter rated for 8A (12A max) with the voltage set at 7V, but I think the sudden load fluctuation caused the converter to break because now I can no longer adjust the output voltage to any other quantity than the input voltage


We had similar problems with regulating our power supply with the Buck converter blowing out - seems like the DROK ones aren't all that reliable. We used a 5v voltage regulator like the one shown here https://www.adafruit.com/product/2164 and wired it together through a breadboard. I'm sure you can solder too, and a quick google search pulls up similar products for 7v: http://www.mouser.com/ProductDetail/ROHM-Semiconductor/BA17807T/?qs=4kLU8WoGk0v9K7nzkiqL8w%3D%3D&gclid=Cj0KEQjwi7vIBRDpo9W8y7Ct6ZcBEiQA1CwV2H9MLfGRsuOwx8IA7GAir0b4Wezg2Wu01Niyz2f_bx0aAvOz8P8HAQ. I suppose you'll have to find one that fits your current draw; our 5v one heated up a lot but it still worked.

User avatar
windu34
Moderator
Moderator
Posts: 1207
Joined: April 19th, 2015, 6:37 pm
Division: Grad
State: FL
Location: Gainesville, Florida
Contact:

Re: Electric Vehicle C

Postby windu34 » May 7th, 2017, 12:50 pm

dcrxcode wrote:
windu34 wrote:Any suggestions for regulating my power supply to my brushless ESC? I tried using a buck converter rated for 8A (12A max) with the voltage set at 7V, but I think the sudden load fluctuation caused the converter to break because now I can no longer adjust the output voltage to any other quantity than the input voltage


We had similar problems with regulating our power supply with the Buck converter blowing out - seems like the DROK ones aren't all that reliable. We used a 5v voltage regulator like the one shown here https://www.adafruit.com/product/2164 and wired it together through a breadboard. I'm sure you can solder too, and a quick google search pulls up similar products for 7v: http://www.mouser.com/ProductDetail/ROHM-Semiconductor/BA17807T/?qs=4kLU8WoGk0v9K7nzkiqL8w%3D%3D&gclid=Cj0KEQjwi7vIBRDpo9W8y7Ct6ZcBEiQA1CwV2H9MLfGRsuOwx8IA7GAir0b4Wezg2Wu01Niyz2f_bx0aAvOz8P8HAQ. I suppose you'll have to find one that fits your current draw; our 5v one heated up a lot but it still worked.

Thanks! Ill try it!
President of Science Olympiad at the University of Florida || Boca Raton Community High School Alumni
kevin@floridascienceolympiad.org
windu34's Userpage

Event Supervisor for 2019:
MIT Invitational - Mission Possible
Harvard Invitational - Sounds of Music
Princeton Invitational - Herpetology

User avatar
markuswso17
Member
Member
Posts: 29
Joined: March 19th, 2017, 11:34 am
Division: Grad
State: VA
Contact:

Re: Electric Vehicle C

Postby markuswso17 » May 12th, 2017, 12:37 pm

What do you guys think top 3 National scores will be? Also what do you think is the width of the thinnest vehicle at nationals?
Last edited by markuswso17 on May 12th, 2017, 6:57 pm, edited 1 time in total.
Alumni
Fairfax High School Captain 2017
Electric Vehicle Nationals 4th place 2017
Email: markuswso17@gmail.com
Facebook: https://tinyurl.com/markuswso17FB
2016-2017 Events: Electric Vehicle, Forensics, Game On, Robot Arm

User avatar
Bazinga+
Exalted Member
Exalted Member
Posts: 383
Joined: March 8th, 2014, 7:10 am
Division: C
State: NY
Location: Ward Melville HD
Contact:

Re: Electric Vehicle C

Postby Bazinga+ » May 12th, 2017, 3:25 pm

markuswso17 wrote:What do you guys think top 3 National scores will be? Also what diy up think is the width of the thinnest vehicle at nationals?

I know somebody who has a very successful vehicle which is around 4cm thick (I think they go for a 6-7 cm bonus). Expecting them to win first with about -18 or -19 score, and 2nd and 3rd to be around -15 or -16.
Innovation =/= success

User avatar
windu34
Moderator
Moderator
Posts: 1207
Joined: April 19th, 2015, 6:37 pm
Division: Grad
State: FL
Location: Gainesville, Florida
Contact:

Re: Electric Vehicle C

Postby windu34 » May 12th, 2017, 3:35 pm

I think 1st will be -16 or -15 ish. In practice, there are just too many variables and interpolation will take away some accuracy. I think 6th will be around -11 or -12
President of Science Olympiad at the University of Florida || Boca Raton Community High School Alumni
kevin@floridascienceolympiad.org
windu34's Userpage

Event Supervisor for 2019:
MIT Invitational - Mission Possible
Harvard Invitational - Sounds of Music
Princeton Invitational - Herpetology


Return to “Electric Vehicle C”

Who is online

Users browsing this forum: No registered users and 1 guest